@@ -101,10 +101,11 @@ jobs:
101
101
102
102
commit_generated_changelog :
103
103
permissions :
104
- # Give the default GITHUB_TOKEN write permission to commit and push the
105
- # added or changed files to the repository.
106
104
contents : write
105
+ pull-requests : write
107
106
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]')
108
109
runs-on : ubuntu-latest
109
110
steps :
110
111
- uses : actions/checkout@v4
@@ -113,18 +114,21 @@ jobs:
113
114
with :
114
115
name : changelog_post_lint
115
116
path : ~/changelog_build
116
- - name : Changelog deployment
117
+ - name : add changelog to git
117
118
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