Skip to content

Commit ea6d902

Browse files
harilvfsaayushrg7nissxnixaayushxvf
committed
Update module.yml
Co-Authored-By: aayush <[email protected]> Co-Authored-By: Smriti Bhandari <[email protected]> Co-Authored-By: aayushxvf <[email protected]>
1 parent 15b2e2c commit ea6d902

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

.github/workflows/module.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,48 @@
1-
name: 'Update Carch Submodule'
1+
name: 'Update Carch-X Submodule'
22

33
on:
44
push:
5+
branches:
6+
- 'main' # Trigger on push to the main branch
57
paths:
6-
- 'carch-x/**'
7-
workflow_dispatch:
8+
- 'carch-x/**' # Detects changes in the carch-x submodule
9+
workflow_dispatch: # Allows manual triggering of the workflow
810

911
permissions:
10-
contents: write
11-
actions: read
12+
contents: write # This grants read and write access to repository contents (pushes, commits, etc.)
13+
actions: read # This grants read access to actions (necessary for workflow)
1214

1315
jobs:
1416
update-submodule:
1517
runs-on: ubuntu-latest
1618

1719
steps:
18-
- name: Checkout documentation repository
20+
- name: Checkout carch repository
1921
uses: actions/checkout@v3
2022
with:
21-
token: ${{ secrets.GITHUB_TOKEN }}
23+
token: ${{ secrets.GITHUB_TOKEN }} # Use the token with the specified permissions
2224

2325
- name: Set Git identity
2426
run: |
2527
git config --global user.name "GitHub Actions"
2628
git config --global user.email "[email protected]"
2729
28-
- name: Initialize and update submodules
30+
- name: Initialize and update carch-x submodule
2931
run: |
3032
git submodule init
31-
git submodule update
33+
git submodule update --remote carch-x # Pull the latest commit for the carch-x submodule
3234
33-
- name: Pull latest changes for submodule
35+
- name: Check for changes in carch-x submodule
3436
run: |
35-
cd carch
36-
git fetch --all
37-
git checkout main
38-
git pull origin main
37+
if git diff --exit-code carch-x; then
38+
echo "No changes in carch-x submodule."
39+
else
40+
echo "carch-x submodule has changes"
41+
fi
3942
40-
- name: Commit and push changes to the docs repository
43+
- name: Commit and push changes to the carch repository
4144
run: |
42-
git add carch
43-
git commit -m "Update carch submodule"
44-
git push origin main
45+
git add carch-x # Add changes from the carch-x submodule
46+
git commit -m "Update carch-x submodule" || echo "No changes to commit"
47+
git push origin main # Push the updates to the main branch
48+

0 commit comments

Comments
 (0)