From df48a351a53d2c41badc3c4e7bac57e8471bb058 Mon Sep 17 00:00:00 2001 From: Michael Langmayr Date: Mon, 2 Feb 2026 17:16:07 -0800 Subject: [PATCH] add flow that checks for updates in submodules and creates a PR to update them overnight --- .github/workflows/update-submodules.yml | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/update-submodules.yml diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml new file mode 100644 index 0000000..8c13fc8 --- /dev/null +++ b/.github/workflows/update-submodules.yml @@ -0,0 +1,63 @@ +name: Update Submodules + +on: + schedule: + # Run every night at 2 AM UTC + - cron: '0 2 * * *' + workflow_dispatch: # Allow manual trigger + +jobs: + update-submodules: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Update submodules to latest + id: update + run: | + # Update all submodules to their latest remote commits + git submodule update --remote --init --recursive + + # Check if there are any changes + if git diff --quiet; then + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "No submodule updates found" + else + echo "has_changes=true" >> $GITHUB_OUTPUT + echo "Submodule updates found:" + git diff --submodule=short + fi + + - name: Create Pull Request + if: steps.update.outputs.has_changes == 'true' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: update submodules" + title: "chore: Update submodules" + body: | + This PR updates submodules to their latest commits. + + **Updated submodules:** + ``` + ${{ steps.update.outputs.diff || 'See commit for details' }} + ``` + + --- + *This PR was automatically created by the update-submodules workflow.* + branch: automated/update-submodules + delete-branch: true + labels: | + automated + dependencies