Skip to content

Commit

Permalink
[skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinn-it-gea committed Aug 5, 2024
1 parent 2760ad4 commit ca0733f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/update-submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ jobs:
submodules: 'recursive'

- name: Update submodules
id: update
run: |
# Update submodules
git submodule update --init --remote
# Capture the last commit ID of the submodule
SUBMODULE_COMMIT=$(git -C build rev-parse HEAD)
echo "Submodule commit: $SUBMODULE_COMMIT"
# Check for changes
git status --porcelain
if [ -n "$(git status --porcelain)" ]; then
echo "Submodule updates found"
Expand Down Expand Up @@ -47,16 +54,11 @@ jobs:
git commit -m "Update submodules to latest commits"
git push origin $BRANCH_NAME
# Create a Pull Request
gh pr create --title "Update submodules" --body "This PR updates all submodules to their latest commits." --base master --head $BRANCH_NAME
# Create a Pull Request with submodule commit ID in the title
PR_TITLE="Update submodules to latest commits (submodule commit: $SUBMODULE_COMMIT)"
gh pr create --title "$PR_TITLE" --body "This PR updates all submodules to their latest commits." --base master --head $BRANCH_NAME
else
echo "No submodule updates found"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup branches (Optional)
run: |
# Clean up local branches that are no longer on the remote
git fetch --prune
git branch -vv | awk '/: gone]/ {print $1}' | xargs git branch -d

0 comments on commit ca0733f

Please sign in to comment.