Update Submodules #20
This file contains 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
name: Update Submodules | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Weekly schedule at midnight UTC | |
workflow_dispatch: | |
jobs: | |
update_submodules: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Fetch all branches | |
run: | | |
git fetch --all | |
- name: Checkout or create update branch | |
run: | | |
git checkout -B update-submodules-branch origin/update-submodules-branch || git checkout -b update-submodules-branch | |
- name: Update submodules to latest commits | |
run: | | |
git submodule update --remote --merge | |
git submodule status | |
- name: Check for submodule updates | |
id: check_submodule_update | |
run: | | |
git diff --quiet || echo "Submodule updates found" && echo "::set-output name=needs_update::true" | |
- name: Commit and push changes | |
if: steps.check_submodule_update.outputs.needs_update == 'true' | |
run: | | |
git add . | |
git commit -m "Update submodules to latest commits" | |
git push origin update-submodules-branch --force | |
- name: Create or update Pull Request | |
if: steps.check_submodule_update.outputs.needs_update == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Update submodules | |
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
branch: update-submodules-branch | |
base: main | |
title: Update Submodules | |
body: This pull request updates submodules to their latest commits. |