-
-
Notifications
You must be signed in to change notification settings - Fork 505
51 lines (39 loc) · 1.33 KB
/
sync-modules.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
41
42
43
44
45
46
47
48
49
50
51
name: Sync modules (beta)
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Run every 6 hours
schedule:
- cron: '0 */6 * * *'
env:
MODULES_BRANCH: main
COMPANION_BRANCH: main
jobs:
sync-modules:
if: ${{ github.repository_owner == 'bitfocus' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
ref: ${{ env.COMPANION_BRANCH }}
token: ${{ secrets.SYNC_MODULES_PAT }}
- name: update submodule
run: |
cd bundled-modules
FROM_COMMIT=$(git rev-parse HEAD)
git checkout ${{ env.MODULES_BRANCH }}
git pull
TO_COMMIT=$(git rev-parse HEAD)
CHANGES_MESSAGE=$(git log --oneline --no-decorate ${FROM_COMMIT}..${TO_COMMIT})
echo "Changes: "$CHANGES_MESSAGE
echo "CHANGES_MESSAGE<<EOF" >> $GITHUB_ENV
echo "$CHANGES_MESSAGE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Commit module updates
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update bundled-modules\n\n${{ env.CHANGES_MESSAGE }}"
commit_author: 'Companion Module Sync <[email protected]>'