Skip to content

Commit eba3e08

Browse files
committed
fix changelog generation [build changelog]
xref: #1850
1 parent 77f5832 commit eba3e08

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

.github/workflows/changelog_generator.yml

+20-16
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ jobs:
101101
102102
commit_generated_changelog:
103103
permissions:
104-
# Give the default GITHUB_TOKEN write permission to commit and push the
105-
# added or changed files to the repository.
106104
contents: write
105+
pull-requests: write
107106
needs: lint_generated_changelog
107+
# Run only if the head commit message contains "[build changelog]""
108+
if: contains(github.event.head_commit.message, '[build changelog]')
108109
runs-on: ubuntu-latest
109110
steps:
110111
- uses: actions/checkout@v4
@@ -113,18 +114,21 @@ jobs:
113114
with:
114115
name: changelog_post_lint
115116
path: ~/changelog_build
116-
- name: Changelog deployment
117+
- name: add changelog to git
117118
run: |
118-
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
119-
mv ~/changelog_build/CHANGES.md ${{ github.workspace }}/src/CHANGES.md
120-
merge_message=$(git log -1 | grep Merge | grep "pull")
121-
PR_number=$(echo $merge_message | cut -d ' ' -f 4)
122-
git config credential.helper 'cache --timeout=120'
123-
git config user.email "[email protected]"
124-
git config user.name "bids-maintenance"
125-
git add ${{ github.workspace }}/src/CHANGES.md
126-
git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}"
127-
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/bids-standard/bids-specification.git master
128-
else
129-
echo "Did not detect a "Merge commit" to master, or detected a Release ... doing nothing."
130-
fi
119+
mv ~/changelog_build/CHANGES.md ${{ github.workspace }}/src/CHANGES.md
120+
git config credential.helper 'cache --timeout=120'
121+
git config user.email "[email protected]"
122+
git config user.name "bids-maintenance"
123+
git add ${{ github.workspace }}/src/CHANGES.md
124+
git commit -m "[DOC] Auto-generated changelog entry"
125+
- name: Create Pull Request
126+
uses: peter-evans/create-pull-request@v6
127+
with:
128+
token: ${{ secrets.GITHUB_TOKEN }}
129+
branch: changelog_generator_update
130+
delete-branch: true
131+
title: '[DOC] Auto-generated changelog entry'
132+
labels: |
133+
exclude-from-changelog
134+
draft: false

0 commit comments

Comments
 (0)