Skip to content

Commit db6a2cf

Browse files
committed
ci: Add actions to write to changelog.entries on each merged PRs
1 parent edcaaed commit db6a2cf

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/changelog.entries

Whitespace-only changes.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Update changelog on PR merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- master
8+
9+
jobs:
10+
update:
11+
if: github.event.pull_request.merged == true
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: read
16+
steps:
17+
- id: check-title
18+
run: |
19+
PR_TITLE="${{ github.event.pull_request.title }}"
20+
PR_NUMBER=${{ github.event.pull_request.number }}
21+
PR_AUTHOR=${{ github.event.pull_request.user.login }}
22+
ALLOWED_PREFIXES="^(core|desktop|web|avm1|avm2|docs|chore|tests): " # more tags here
23+
if [[ ! "$PR_TITLE" =~ $ALLOWED_PREFIXES ]]; then
24+
echo "skip_collect=true" >> $GITHUB_OUTPUT
25+
exit 0
26+
fi
27+
echo "entry=$PR_TITLE" >> $GITHUB_OUTPUT
28+
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
29+
echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT
30+
- name: Checkout repository, write to first line and push
31+
if: steps.check-title.outputs.skip_collect != 'true'
32+
uses: actions/checkout@v6
33+
run: |
34+
touch .github/changelog.entries
35+
sed -i "1i ${{ steps.check-title.outputs.entry }} by ${{ steps.check-title.outputs.author }} in #${{ steps.check-title.outputs.number }}" .github/changelog.entries
36+
git config user.name "github-actions[bot]"
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
git add .github/changelog.entries
39+
git commit -m "ci: update changelog.entries"
40+
git push

0 commit comments

Comments
 (0)