Files
dotfiles/.github/workflows/update-submodules.yml

45 lines
1.2 KiB
YAML

---
name: Update submodules
on:
schedule:
# At 04:00 on Monday and Thursday.
- cron: "0 4 * * 1,4"
workflow_dispatch:
jobs:
update-submodules:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{secrets.GITHUB_TOKEN}}
- name: Config Git User
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update submodules
run: |
git submodule sync
git submodule foreach --quiet '
tag="$(git describe --tags --abbrev=0 origin/HEAD)"
if [ "$(git describe --tags)" != "$tag" ]; then
git checkout --quiet "$tag"
echo "$name updated to $tag"
fi
'
if git diff --quiet; then
echo "No updates for submodules."
else
git add .
git commit -m "chore(git): Update submodules (automated)"
git show --raw
git push
fi