@@ -2,7 +2,7 @@ name: Release
22
33on :
44 release :
5- types : [published]
5+ types : [ published ]
66 workflow_dispatch :
77 inputs :
88 tag_name :
1212
1313permissions :
1414 contents : write
15+ pull-requests : write
1516
1617env :
1718 DEFAULT_BRANCH : version-0
@@ -20,33 +21,22 @@ jobs:
2021 update-changelog :
2122 runs-on : ubuntu-latest
2223 steps :
23- - uses : actions/checkout@v4
24+ - name : Checkout tag for build & publish
25+ uses : actions/checkout@v4
2426 with :
2527 token : ${{ secrets.GITHUB_TOKEN }}
2628
29+ # TODO: Add build/publish steps here that use the tagged version
30+
31+ - name : Checkout default branch for changelog
32+ uses : actions/checkout@v4
33+ with :
34+ token : ${{ secrets.GITHUB_TOKEN }}
35+ ref : ${{ env.DEFAULT_BRANCH }}
36+
2737 - name : Update changelog
2838 uses : rhysd/changelog-from-release/action@v3
2939 with :
3040 file : CHANGELOG.md
3141 github_token : ${{ secrets.GITHUB_TOKEN }}
32-
33- - name : Commit and push changelog
34- run : |
35- TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
36- BRANCH_NAME="changelog-update-$TAG_NAME"
37- git checkout -b $BRANCH_NAME
38- git config --local user.email "[email protected] " 39- git config --local user.name "GitHub Action"
40- git add CHANGELOG.md
41- if ! git diff --staged --quiet; then
42- git commit -m "Update CHANGELOG.md for $TAG_NAME"
43- git push origin $BRANCH_NAME
44-
45- gh pr create \
46- --title "Update CHANGELOG.md for $TAG_NAME" \
47- --body "Automated changelog update for release $TAG_NAME" \
48- --base ${{ env.DEFAULT_BRANCH }} \
49- --head $BRANCH_NAME
50- fi
51- env :
52- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42+ pull_request : true
0 commit comments