Skip to content

Commit a268cb1

Browse files
committed
fix: update changelog workflow to target version branches
1 parent 116327d commit a268cb1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/update-changelog.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15+
- name: Determine target branch
16+
id: branch
17+
run: |
18+
# Extract major version from tag (v4.0.1 -> 4.x)
19+
TAG="${{ github.event.release.tag_name }}"
20+
MAJOR=$(echo "$TAG" | sed -E 's/^v([0-9]+)\..*/\1/')
21+
echo "name=${MAJOR}.x" >> $GITHUB_OUTPUT
22+
1523
- name: Checkout code
1624
uses: actions/checkout@v6
1725
with:
18-
ref: main
26+
ref: ${{ steps.branch.outputs.name }}
1927

2028
- name: Update Changelog
2129
uses: stefanzweifel/changelog-updater-action@v1
@@ -26,6 +34,6 @@ jobs:
2634
- name: Commit updated CHANGELOG
2735
uses: stefanzweifel/git-auto-commit-action@v7
2836
with:
29-
branch: main
37+
branch: ${{ steps.branch.outputs.name }}
3038
commit_message: Update CHANGELOG
3139
file_pattern: CHANGELOG.md

0 commit comments

Comments
 (0)