Skip to content

Commit d634c1b

Browse files
ci: Fix changelog
- `update_changelog` → `release_notes`以免混淆。 - `git commit` → PR 以绕开分支保护。 Fixes #478
1 parent 7ca7b99 commit d634c1b

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

Diff for: .github/workflows/release.yml

+20-11
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ jobs:
113113
asset_name: ${{ matrix.cls }}.cls
114114
tag: ${{ github.ref }}
115115

116-
update_changelog:
117-
name: Generate changelog
116+
release_notes:
117+
name: Populate release notes with latest changelog
118118
runs-on: ubuntu-latest
119119
# Makesure it's the last job.
120120
needs: [build, publish_cls, publish_templates]
@@ -189,7 +189,7 @@ jobs:
189189
to [CTAN](https://www.ctan.org/pkg/bithesis)." >> "$GITHUB_STEP_SUMMARY"
190190
191191
changelog:
192-
name: Update changelog
192+
name: Update CHANGELOG
193193
runs-on: ubuntu-latest
194194
if: ${{ ! github.event.release.prerelease }}
195195
steps:
@@ -199,7 +199,7 @@ jobs:
199199
fetch-depth: 0
200200
ref: ${{ github.event.repository.default_branch }}
201201

202-
- name: Generate a changelog
202+
- name: Update CHANGELOG
203203
uses: orhun/git-cliff-action@v3
204204
with:
205205
config: cliff.toml
@@ -208,11 +208,20 @@ jobs:
208208
OUTPUT: CHANGELOG.md
209209
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210210

211-
- name: Commit
211+
- name: Create a PR
212+
# Changes must be made through the merge queue, therefore a PR is necessary.
213+
id: pr
214+
uses: peter-evans/create-pull-request@v6
215+
with:
216+
commit-message: Update CHANGELOG for ${{ github.event.release.tag_name }}
217+
title: Update CHANGELOG for ${{ github.event.release.tag_name }}
218+
219+
- name: Report status
212220
run: |
213-
git config user.name 'github-actions[bot]'
214-
git config user.email 'github-actions[bot]@users.noreply.github.com'
215-
set +e
216-
git add CHANGELOG.md
217-
git commit -m "Update changelog"
218-
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/BITNP/BIThesis.git ${{ github.event.repository.default_branch }}
221+
echo "[Pull request #${{ steps.pr.outputs.pull-request-number }}](${{ steps.pr.outputs.pull-request-url }}) is created to update CHANGELOG." >> "$GITHUB_STEP_SUMMARY"
222+
223+
- name: Merge the PR
224+
run: |
225+
gh pr merge ${{ steps.pr.outputs.pull-request-number }}
226+
env:
227+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)