Skip to content

v4.1.0

v4.1.0 #9

Workflow file for this run

name: Changelog
on:
release:
types: [released]
permissions:
contents: write
pull-requests: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Determine target branch
id: branch
run: |
TAG="${{ github.event.release.tag_name }}"
MAJOR=$(echo "$TAG" | sed -E 's/^v?([0-9]+)\..*/\1/')
BRANCH="${MAJOR}.x"
if ! git ls-remote --exit-code --heads "https://github.com/${{ github.repository }}" "$BRANCH" > /dev/null 2>&1; then
BRANCH="${{ github.event.repository.default_branch }}"
fi
echo "name=${BRANCH}" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ steps.branch.outputs.name }}
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Open changelog PR
id: cpr
uses: peter-evans/create-pull-request@v8
with:
base: ${{ steps.branch.outputs.name }}
branch: chore/changelog-${{ github.event.release.tag_name }}
delete-branch: true
commit-message: "chore: update CHANGELOG for ${{ github.event.release.tag_name }}"
title: "chore: update CHANGELOG for ${{ github.event.release.tag_name }}"
body: |
Auto-generated CHANGELOG update for release ${{ github.event.release.tag_name }}.
Release notes: ${{ github.event.release.html_url }}
labels: skip-changelog
- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-operation == 'created'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}"