Update submodules #6
This file contains hidden or 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
| # Nightly job that bumps every git submodule to the latest upstream HEAD | |
| # and opens (or updates) a PR so the change goes through normal review. | |
| name: Update submodules | |
| on: | |
| schedule: | |
| # 03:00 UTC every day | |
| - cron: "0 3 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update: | |
| name: Bump submodules to latest HEAD | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (no submodules) | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - name: Update every submodule to remote HEAD | |
| id: update | |
| shell: bash | |
| run: | | |
| git submodule sync | |
| git submodule update --init --remote --depth 1 | |
| if git diff --quiet HEAD; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Commit and push if changed | |
| if: steps.update.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "chore: update submodules to latest HEAD" | |
| git push origin HEAD:main |