Skip to content

Commit 9d2b208

Browse files
committed
update notify-parent-repo action
1 parent 56e8593 commit 9d2b208

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
1-
name: Notify Parent Repo
1+
name: Notify parent repo of submodule updates
22

33
on:
44
push:
5-
branches:
5+
branches:
66
- main
7-
permissions:
8-
contents: write
7+
workflow_dispatch:
98

109
jobs:
11-
update-parent:
10+
update:
11+
if: github.repository == 'euc-dev/ws1-sdk-intelligence'
1212
runs-on: ubuntu-latest
13+
1314
steps:
14-
- name: Checkout current repository
15-
uses: actions/checkout@v6
16-
with:
17-
fetch-depth: 0
15+
- uses: actions/checkout@v4
16+
with:
17+
repository: ${{ secrets.PARENT_ORG }}/${{ secrets.PARENT_REPO }}
1818
token: ${{ secrets.PRIVATE_TOKEN }}
19+
submodules: true
1920

20-
- name: Checkout parent repository
21-
uses: actions/checkout@v6
22-
with:
23-
repository: ${{ vars.PARENT_ORG }}/${{ vars.PARENT_REPO }}
24-
token: ${{ secrets.PRIVATE_TOKEN }}
25-
submodules: recursive
21+
- name: Pull and recursively update submodules
22+
run: |
23+
git submodule update --init --recursive
24+
git submodule update --recursive --remote
2625
27-
- name: Commit changes to parent repo
26+
- name: Commit submodule updates
2827
run: |
29-
cp -r ./* ./${{ vars.PARENT_REPO }}/
30-
cd ./${{ vars.PARENT_REPO }}
31-
git config user.name "github-actions[bot]"
32-
git config user.email "github-actions[bot]@users.noreply.github.com"
28+
git config user.email "actions@github.com"
29+
git config user.name "GitHub Actions - update submodules"
3330
git add --all
3431
git commit -m "Update submodules, triggered by ${GITHUB_REPOSITORY}" || echo "No changes to commit"
35-
git push https://${{ secrets.PRIVATE_TOKEN }}@github.com/${{ vars.PARENT_ORG }}/${{ vars.PARENT_REPO }}.git main
32+
git push

0 commit comments

Comments
 (0)