From d6092b703e36c2a01215192946be690b2950f5a9 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 09:28:50 +0100 Subject: [PATCH 01/13] Begin work on notebook update action --- .github/workflows/push.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 19d3b73c37..8abaabebe5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -24,3 +24,34 @@ jobs: branch: ${{ github.ref_name }} build_dev: true secrets: inherit + + colab: + name: Update Colab notebooks + runs-on: ubuntu-latest + steps: + - name: Checkout Firedrake + uses: actions/checkout@v5 + with: + path: firedrake + + - name: Checkout Colab notebooks + uses: actions/checkout@v5 + with: + repo: firedrakeproject/notebooks + branch: ${{ github.ref_name }} + path: notebooks + + - name: Prepare notebooks for Colab + run: | + for $notebook in firedrake/docs/notebooks/*.ipynb; do + ./notebooks/??? $notebook + done + + - name: Push changes if needed + working-directory: notebooks + run: | + if [ -z $(git diff ???) ]; then + git add --all . + git commit -m "Upstream updates" + git push + fi From 83873e9d3f01456033d94d5942b40b100c0aaad7 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 11:48:10 +0100 Subject: [PATCH 02/13] updates --- .github/workflows/pr.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/push.yml | 13 +++++++------ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a1430b57e7..d25918a736 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,3 +13,36 @@ jobs: # Only run macOS tests if the PR is labelled 'macOS' test_macos: ${{ contains(github.event.pull_request.labels.*.name, 'macOS') }} secrets: inherit + + # UNDO ME, just for testing + colab: + name: Update Colab notebooks + runs-on: ubuntu-latest + steps: + - name: Checkout Firedrake + uses: actions/checkout@v5 + with: + path: firedrake + ref: release + + - name: Checkout Colab notebooks + uses: actions/checkout@v5 + with: + repo: firedrakeproject/notebooks + path: notebooks + + - name: Copy notebooks + run: cp -r firedrake/docs/notebooks/* notebooks/ + + - name: Prepare notebooks for Colab + working-directory: notebooks + run: ./utils/firedrake-colab-notebooks *.ipynb + + - name: Push changes if needed + working-directory: notebooks + run: | + if [ ! -z "$( git status --porcelain )" ]; then + git add --all . + git commit -m "Upstream updates" + git push + fi diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8abaabebe5..04bf7d84eb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -27,6 +27,7 @@ jobs: colab: name: Update Colab notebooks + if: github.ref_name == 'release' runs-on: ubuntu-latest steps: - name: Checkout Firedrake @@ -38,19 +39,19 @@ jobs: uses: actions/checkout@v5 with: repo: firedrakeproject/notebooks - branch: ${{ github.ref_name }} path: notebooks + - name: Copy notebooks + run: cp -r firedrake/docs/notebooks/* notebooks/ + - name: Prepare notebooks for Colab - run: | - for $notebook in firedrake/docs/notebooks/*.ipynb; do - ./notebooks/??? $notebook - done + working-directory: notebooks + run: ./utils/firedrake-colab-notebooks *.ipynb - name: Push changes if needed working-directory: notebooks run: | - if [ -z $(git diff ???) ]; then + if [ ! -z "$( git status --porcelain )" ]; then git add --all . git commit -m "Upstream updates" git push From ec15422658bc82f4ce9b60072308982b8f91163c Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 11:49:56 +0100 Subject: [PATCH 03/13] fixup --- .github/workflows/pr.yml | 2 +- .github/workflows/push.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d25918a736..8519a4d9aa 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -28,7 +28,7 @@ jobs: - name: Checkout Colab notebooks uses: actions/checkout@v5 with: - repo: firedrakeproject/notebooks + repository: firedrakeproject/notebooks path: notebooks - name: Copy notebooks diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 04bf7d84eb..4cbd20e7dc 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -38,7 +38,7 @@ jobs: - name: Checkout Colab notebooks uses: actions/checkout@v5 with: - repo: firedrakeproject/notebooks + repository: firedrakeproject/notebooks path: notebooks - name: Copy notebooks From ea628ea4960fbc8fdd50b3d5f0caabb8e7db067e Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 11:52:01 +0100 Subject: [PATCH 04/13] fixup --- .github/workflows/pr.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8519a4d9aa..60647c5493 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,6 +19,13 @@ jobs: name: Update Colab notebooks runs-on: ubuntu-latest steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install nbformat + - name: Checkout Firedrake uses: actions/checkout@v5 with: From 39d82791affaf71a6eec1df012455888babdd32c Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 11:56:28 +0100 Subject: [PATCH 05/13] fixup --- .github/workflows/pr.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 60647c5493..e06f4e6b69 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,7 +48,11 @@ jobs: - name: Push changes if needed working-directory: notebooks run: | + : # debugging + git status if [ ! -z "$( git status --porcelain )" ]; then + git config user.name "Firedrake" + git config user.email "dummyemail@github.com" git add --all . git commit -m "Upstream updates" git push From 7baec998aaf4478f6f64c88897f551af97820ca8 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 11:58:08 +0100 Subject: [PATCH 06/13] fixup --- .github/workflows/pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e06f4e6b69..27bd331250 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -18,6 +18,8 @@ jobs: colab: name: Update Colab notebooks runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/setup-python@v5 with: From 2342b8e92af6527cb6a71fc8a2c95db81a047728 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 13:05:55 +0100 Subject: [PATCH 07/13] fixup --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 27bd331250..ec6b641f17 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -39,13 +39,14 @@ jobs: with: repository: firedrakeproject/notebooks path: notebooks + token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} - name: Copy notebooks run: cp -r firedrake/docs/notebooks/* notebooks/ - name: Prepare notebooks for Colab working-directory: notebooks - run: ./utils/firedrake-colab-notebooks *.ipynb + run: ./utils/firedrake-colab-notebooks ./*.ipynb - name: Push changes if needed working-directory: notebooks From 6d9e72f9ceb445c8a1018eae1783d04e736c8d4e Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 13:09:22 +0100 Subject: [PATCH 08/13] fixup --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ec6b641f17..2c962ccdd7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -39,7 +39,7 @@ jobs: with: repository: firedrakeproject/notebooks path: notebooks - token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} + token: ${{ github.NOTEBOOKS_REPO_TOKEN }} - name: Copy notebooks run: cp -r firedrake/docs/notebooks/* notebooks/ From 8745d0c89749a13d8e0c814ec33604c63ce39842 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 13:16:50 +0100 Subject: [PATCH 09/13] empty From 3cde6ad6c4905df326359f316fca23e4cb846338 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 13:17:24 +0100 Subject: [PATCH 10/13] fixup --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2c962ccdd7..ec6b641f17 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -39,7 +39,7 @@ jobs: with: repository: firedrakeproject/notebooks path: notebooks - token: ${{ github.NOTEBOOKS_REPO_TOKEN }} + token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} - name: Copy notebooks run: cp -r firedrake/docs/notebooks/* notebooks/ From 06cfb2cb6f7f1caff5154728d363e42f57a07df2 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 13:22:28 +0100 Subject: [PATCH 11/13] Final cleanup, it works --- .github/workflows/pr.yml | 47 -------------------------------------- .github/workflows/push.yml | 16 ++++++++++++- 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ec6b641f17..a1430b57e7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,50 +13,3 @@ jobs: # Only run macOS tests if the PR is labelled 'macOS' test_macos: ${{ contains(github.event.pull_request.labels.*.name, 'macOS') }} secrets: inherit - - # UNDO ME, just for testing - colab: - name: Update Colab notebooks - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - name: Install dependencies - run: pip install nbformat - - - name: Checkout Firedrake - uses: actions/checkout@v5 - with: - path: firedrake - ref: release - - - name: Checkout Colab notebooks - uses: actions/checkout@v5 - with: - repository: firedrakeproject/notebooks - path: notebooks - token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} - - - name: Copy notebooks - run: cp -r firedrake/docs/notebooks/* notebooks/ - - - name: Prepare notebooks for Colab - working-directory: notebooks - run: ./utils/firedrake-colab-notebooks ./*.ipynb - - - name: Push changes if needed - working-directory: notebooks - run: | - : # debugging - git status - if [ ! -z "$( git status --porcelain )" ]; then - git config user.name "Firedrake" - git config user.email "dummyemail@github.com" - git add --all . - git commit -m "Upstream updates" - git push - fi diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4cbd20e7dc..a23bcd8656 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -29,7 +29,16 @@ jobs: name: Update Colab notebooks if: github.ref_name == 'release' runs-on: ubuntu-latest + permissions: + contents: write steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install nbformat + - name: Checkout Firedrake uses: actions/checkout@v5 with: @@ -40,18 +49,23 @@ jobs: with: repository: firedrakeproject/notebooks path: notebooks + token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} - name: Copy notebooks run: cp -r firedrake/docs/notebooks/* notebooks/ - name: Prepare notebooks for Colab working-directory: notebooks - run: ./utils/firedrake-colab-notebooks *.ipynb + run: ./utils/firedrake-colab-notebooks ./*.ipynb - name: Push changes if needed working-directory: notebooks run: | if [ ! -z "$( git status --porcelain )" ]; then + echo "Changes detected" + git status + git config user.name "Firedrake" + git config user.email "dummyemail@github.com" git add --all . git commit -m "Upstream updates" git push From 02e9ea571355f967b2cea6a84cdbc88166a3aa17 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 13 Oct 2025 13:40:43 +0100 Subject: [PATCH 12/13] Use newer Python --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a23bcd8656..cf39242c29 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -34,7 +34,7 @@ jobs: steps: - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.13' - name: Install dependencies run: pip install nbformat From 509e726c69663b323b710bcd8f19181778555c08 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Tue, 14 Oct 2025 09:45:46 +0100 Subject: [PATCH 13/13] Move workflow to release.yml and use GitHub bot account for commits --- .github/workflows/push.yml | 46 ---------------------------------- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cf39242c29..19d3b73c37 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -24,49 +24,3 @@ jobs: branch: ${{ github.ref_name }} build_dev: true secrets: inherit - - colab: - name: Update Colab notebooks - if: github.ref_name == 'release' - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.13' - - - name: Install dependencies - run: pip install nbformat - - - name: Checkout Firedrake - uses: actions/checkout@v5 - with: - path: firedrake - - - name: Checkout Colab notebooks - uses: actions/checkout@v5 - with: - repository: firedrakeproject/notebooks - path: notebooks - token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} - - - name: Copy notebooks - run: cp -r firedrake/docs/notebooks/* notebooks/ - - - name: Prepare notebooks for Colab - working-directory: notebooks - run: ./utils/firedrake-colab-notebooks ./*.ipynb - - - name: Push changes if needed - working-directory: notebooks - run: | - if [ ! -z "$( git status --porcelain )" ]; then - echo "Changes detected" - git status - git config user.name "Firedrake" - git config user.email "dummyemail@github.com" - git add --all . - git commit -m "Upstream updates" - git push - fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9063bacea2..b54966a37c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,3 +72,50 @@ jobs: tag: ${{ inputs.version }} branch: ${{ inputs.branch }} secrets: inherit + + colab: + name: Update Colab notebooks + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install dependencies + run: pip install nbformat + + - name: Checkout Firedrake + uses: actions/checkout@v5 + with: + path: firedrake + ref: ${{ inputs.branch }} + + - name: Checkout Colab notebooks + uses: actions/checkout@v5 + with: + repository: firedrakeproject/notebooks + path: notebooks + token: ${{ secrets.NOTEBOOKS_REPO_TOKEN }} + + - name: Copy notebooks + run: cp -r firedrake/docs/notebooks/* notebooks/ + + - name: Prepare notebooks for Colab + working-directory: notebooks + run: ./utils/firedrake-colab-notebooks ./*.ipynb + + - name: Push changes if needed + working-directory: notebooks + run: | + if [ ! -z "$( git status --porcelain )" ]; then + echo "Changes detected" + git status + # Use the GitHub bot user account information + git config user.name "GitHub Actions" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add --all . + git commit -m "Upstream updates" + git push + fi