-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into eqctier3-8fb95b6f-11bb-44f8-a1b8-a3953512d144
- Loading branch information
Showing
58 changed files
with
23,329 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: deploy-book | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
PRE_BUILD_DIR: "_pre_build" | ||
|
||
jobs: | ||
deploy-book: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
cache: 'pip' | ||
- run: pip install -r requirements.txt | ||
- run: make build-book PRE_BUILD_DIR=${{ env.PRE_BUILD_DIR }} | ||
- run: touch ${{ env.PRE_BUILD_DIR }}/_build/html/.nojekyll | ||
- uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: "${{ env.PRE_BUILD_DIR }}/_build/html" | ||
# See: https://github.com/marketplace/actions/deploy-pr-preview#ensure-your-main-deployment-is-compatible | ||
clean-exclude: pr-preview/ | ||
force: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
name: on-pull-request | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- closed | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PRE_BUILD_DIR: "_pre_build" | ||
PRE_BUILD_FLAGS: "--disclaimer" | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
- uses: pre-commit/action@v3.0.1 | ||
|
||
deploy-preview: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: git fetch origin gh-pages | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
cache: 'pip' | ||
- uses: actions/checkout@v4 | ||
- name: Get changed notebooks | ||
id: changed-files | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
files: | | ||
**.ipynb | ||
- name: Remove untouched notebooks | ||
id: remove-untouched-notebooks | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
run: |- | ||
for file in ${ALL_CHANGED_FILES}; do | ||
mv "$file" "$file".keep | ||
done | ||
find . -type f -name "*.ipynb" -not -path "./templates/*" -exec rm -f {} + | ||
for file in ${ALL_CHANGED_FILES}; do | ||
mv "$file".keep "$file" | ||
done | ||
- run: pip install -r requirements.txt | ||
- run: make build-book PRE_BUILD_DIR=${{ env.PRE_BUILD_DIR }} PRE_BUILD_FLAGS=${{ env.PRE_BUILD_FLAGS }} | ||
- uses: rossjrw/pr-preview-action@v1 | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
with: | ||
source-dir: "${{ env.PRE_BUILD_DIR }}/_build/html" | ||
|
||
comment-pr: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get changed notebooks | ||
id: changed-files | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
files: | | ||
**.ipynb | ||
- name: Build permalinks | ||
id: build-permalinks | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
run: |- | ||
permalinks="<ul>" | ||
for fullfile in ${ALL_CHANGED_FILES}; do | ||
fullfile="${fullfile//\\&/&}" | ||
commit=$(git rev-list -1 HEAD "$fullfile") | ||
suffix="${fullfile//&/%26}" | ||
url=${{ github.server_url }}/${{ github.repository }}/blob/$commit/$suffix | ||
permalinks+="<li><a href=\"$url\">$url</a></li>" | ||
done | ||
permalinks+="</ul>" | ||
echo "permalinks=$permalinks" >>"$GITHUB_OUTPUT" | ||
- name: Build URLs | ||
id: build-urls | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
run: |- | ||
permalinks="<ul>" | ||
previews="<ul>" | ||
for fullfile in ${ALL_CHANGED_FILES}; do | ||
fullfile="${fullfile//\\&/&}" | ||
commit=$(git rev-list -1 HEAD "$fullfile") | ||
suffix="${fullfile//&/%26}" | ||
permalink=${{ github.server_url }}/${{ github.repository }}/blob/$commit/$suffix | ||
permalinks+="<li><a href=\"$permalink\">$permalink</a></li>" | ||
suffix="${fullfile/.ipynb/.html}" | ||
preview=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}/$suffix | ||
previews+="<li><a href=\"$preview\">$preview</a></li>" | ||
done | ||
permalinks+="</ul>" | ||
echo "permalinks=$permalinks" >>"$GITHUB_OUTPUT" | ||
previews+="</ul>" | ||
echo "previews=$previews" >>"$GITHUB_OUTPUT" | ||
- name: Comment PR with permalinks | ||
uses: thollander/actions-comment-pull-request@v3 | ||
with: | ||
message: | | ||
**Permalinks:** | ||
${{ steps.build-urls.outputs.permalinks }} | ||
comment-tag: permalinks | ||
- name: Comment PR with previews | ||
uses: thollander/actions-comment-pull-request@v3 | ||
with: | ||
message: | | ||
**Previews:** | ||
${{ steps.build-urls.outputs.previews }} | ||
comment-tag: previews |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.