Sync Submodules #7
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: Sync Submodules | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # This schedule runs daily at midnight UTC | |
workflow_dispatch: # Allows manual triggering from GitHub UI | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true # Fetches the submodules | |
- name: Update submodules | |
run: | | |
# Update the submodules to the latest commit | |
git submodule update --remote | |
# Check if there are changes in submodules | |
if [ -n "$(git diff --submodule)" ]; then | |
echo "libmpdclient updated." | |
git diff --submodule | |
else | |
echo "No updates." | |
exit 1 # Exit with non-zero status to skip further steps if no changes | |
fi | |
- name: Commit and push changes | |
if: success() # This step will only run if the previous step is successful | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update libmpdclient to latest commit." || echo "No changes to commit" | |
git push |