Skip to content

Commit ca0733f

Browse files
committed
[skip ci]
1 parent 2760ad4 commit ca0733f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.github/workflows/update-submodules.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ jobs:
1616
submodules: 'recursive'
1717

1818
- name: Update submodules
19+
id: update
1920
run: |
21+
# Update submodules
2022
git submodule update --init --remote
2123
24+
# Capture the last commit ID of the submodule
25+
SUBMODULE_COMMIT=$(git -C build rev-parse HEAD)
26+
echo "Submodule commit: $SUBMODULE_COMMIT"
27+
28+
# Check for changes
2229
git status --porcelain
2330
if [ -n "$(git status --porcelain)" ]; then
2431
echo "Submodule updates found"
@@ -47,16 +54,11 @@ jobs:
4754
git commit -m "Update submodules to latest commits"
4855
git push origin $BRANCH_NAME
4956
50-
# Create a Pull Request
51-
gh pr create --title "Update submodules" --body "This PR updates all submodules to their latest commits." --base master --head $BRANCH_NAME
57+
# Create a Pull Request with submodule commit ID in the title
58+
PR_TITLE="Update submodules to latest commits (submodule commit: $SUBMODULE_COMMIT)"
59+
gh pr create --title "$PR_TITLE" --body "This PR updates all submodules to their latest commits." --base master --head $BRANCH_NAME
5260
else
5361
echo "No submodule updates found"
5462
fi
5563
env:
5664
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
58-
- name: Cleanup branches (Optional)
59-
run: |
60-
# Clean up local branches that are no longer on the remote
61-
git fetch --prune
62-
git branch -vv | awk '/: gone]/ {print $1}' | xargs git branch -d

0 commit comments

Comments
 (0)