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