Skip to content

Commit c734165

Browse files
committed
Update
1 parent 6b441da commit c734165

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/update-changelog.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,32 @@ jobs:
3939
run: |
4040
rm git-chglog
4141
42-
- name: Create and Switch to New Branch
42+
- name: Check for Changes
43+
id: check_changes
4344
run: |
44-
git checkout -b update-changelog-${{ github.run_id }}
45+
if git diff --quiet CHANGELOG.md; then
46+
echo "No changes in CHANGELOG.md"
47+
echo "::set-output name=changes::false"
48+
else
49+
echo "Changes detected in CHANGELOG.md"
50+
echo "::set-output name=changes::true"
51+
fi
4552
46-
- name: Commit Changelog
53+
- name: Commit and Push Changes
54+
if: steps.check_changes.outputs.changes == 'true' # Only run if there are changes
4755
uses: stefanzweifel/git-auto-commit-action@v5
4856
with:
4957
commit_message: "Update CHANGELOG"
5058
file_pattern: CHANGELOG.md
51-
branch: update-changelog-${{ github.run_id }} # Commit to the new branch
59+
branch: update-changelog-${{ github.run_id }}
5260

5361
- name: Create Pull Request
62+
if: steps.check_changes.outputs.changes == 'true' # Only run if there are changes
5463
uses: peter-evans/create-pull-request@v4
5564
with:
5665
commit-message: "Update CHANGELOG"
5766
title: "Update Changelog"
5867
body: "This PR updates the entire CHANGELOG to include all releases."
59-
branch: update-changelog-${{ github.run_id }} # Match the branch from the previous step
60-
base: main # Target branch for PR
68+
branch: update-changelog-${{ github.run_id }}
69+
base: main
6170
delete-branch: true # Automatically delete branch after merge

0 commit comments

Comments
 (0)