From 15b52f226cff6f72311eb5a3d073313980b9182e Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 17 Mar 2026 13:57:25 -0500 Subject: [PATCH] Add GitHub Actions workflow to update example-notebooks submodule --- .github/workflows/update-submodule.yml | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/update-submodule.yml diff --git a/.github/workflows/update-submodule.yml b/.github/workflows/update-submodule.yml new file mode 100644 index 00000000..6484f09e --- /dev/null +++ b/.github/workflows/update-submodule.yml @@ -0,0 +1,55 @@ +name: Update example-notebooks submodule + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 1" + +permissions: + contents: write + pull-requests: write + +jobs: + update-submodule: + name: Update example-notebooks submodule + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Update submodule + id: update + run: | + git submodule update --remote docs/example-notebooks + cd docs/example-notebooks + echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + cd .. + if git diff --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Commit and push changes + if: steps.update.outputs.changed == 'true' + run: | + branch="update-example-notebooks-submodule" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b "$branch" + git add docs/example-notebooks + git commit -m "Update example-notebooks submodule to ${{ steps.update.outputs.sha }}" + git push --force origin "$branch" + + - name: Create pull request + if: steps.update.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --title "Update example-notebooks submodule to commit ${{ steps.update.outputs.sha }}" \ + --base master \ + --head "update-example-notebooks-submodule" \