Skip to content

Commit 366b326

Browse files
committed
fix(ci): gracefully and successful exit changelog upon no changes
1 parent fef99e9 commit 366b326

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/reusable_publish_changelog.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ jobs:
2626
git config user.name "Release bot"
2727
git config user.email "[email protected]"
2828
git config pull.rebase true
29-
git config remote.origin.url >&- || git remote add origin https://github.com/$origin # Git Detached mode (release notes) doesn't have origin
30-
git pull origin $BRANCH
29+
git config remote.origin.url >&- || git remote add origin https://github.com/"${origin}" # Git Detached mode (release notes) doesn't have origin
30+
git pull origin "${BRANCH}"
3131
- name: "Generate latest changelog"
3232
run: make changelog
3333
- name: Update Changelog in trunk
3434
run: |
35+
HAS_CHANGE=$(git status --porcelain)
36+
test -z "${HAS_CHANGE}" && echo "Nothing to update" && exit 0
3537
git add CHANGELOG.md
3638
git commit -m "update changelog with latest changes"
37-
git pull origin $BRANCH # prevents concurrent branch update failing push
38-
git push origin HEAD:refs/heads/$BRANCH
39+
git pull origin "${BRANCH}" # prevents concurrent branch update failing push
40+
git push origin HEAD:refs/heads/"${BRANCH}"

0 commit comments

Comments
 (0)