mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
---
|
|
# $schema: "https://json.schemastore.org/github-workflow.json"
|
|
name: Update submodules
|
|
|
|
on:
|
|
schedule:
|
|
# At 04:00 on Monday and Thursday.
|
|
- cron: '0 4 * * 1'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
update-submodules:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions: write-all
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 2
|
|
token: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
- name: Config Git User
|
|
shell: bash
|
|
run: |
|
|
git config --global user.name "${{ github.actor }}"
|
|
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
|
|
|
|
- name: Update submodules
|
|
shell: bash
|
|
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
|