-
Notifications
You must be signed in to change notification settings - Fork 98
40 lines (32 loc) · 1.24 KB
/
Update Submodules.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: 'Update Submodules'
on:
workflow_dispatch:
permissions: write-all
jobs:
sync:
name: 'Update Submodules'
runs-on: ubuntu-latest
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.CI_TOKEN }}
submodules: true
- name: Generate Change Log
id: generate_changelog
run: |
echo "changelog=$(git submodule foreach --quiet 'git log --pretty=format:"%an: %s" HEAD..origin/main' | xargs)" >> $GITHUB_OUTPUT
- name: Update Submodules
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
- name: Commit Change Log
run: |
git config --global user.name 'Git bot'
git config --global user.email 'bot@noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "${{ steps.generate_changelog.outputs.changelog }}" && git push || echo "No changes to commit"