Skip to content

Commit f416cb6

Browse files
Create submodules.yml
1 parent 64eb9ec commit f416cb6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/submodules.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Update submodule
2+
3+
on:
4+
repository_dispatch:
5+
types: [update-submodule]
6+
7+
jobs:
8+
update-submodule:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout parent repo
12+
uses: actions/checkout@v4
13+
with:
14+
ref: git-submodules
15+
submodules: true
16+
token: ${{ secrets.PARENT_REPO_TOKEN }}
17+
18+
- name: Update submodule from payload
19+
run: |
20+
SUBMODULE=${{ github.event.client_payload.submodule }}
21+
echo "Updating submodule: $SUBMODULE"
22+
23+
git config user.name "github-actions[bot]"
24+
git config user.email "github-actions[bot]@users.noreply.github.com"
25+
26+
git submodule update --remote $SUBMODULE
27+
git add $SUBMODULE
28+
git commit -m "Auto-update $SUBMODULE submodule to latest main" || echo "No changes to commit"
29+
git push

0 commit comments

Comments
 (0)