Skip to content

Add release notes automation #1

Add release notes automation

Add release notes automation #1

Workflow file for this run

name: Generate Release Notes PR
on:
pull_request:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
release-notes:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install gren
run: npm install -g github-release-notes
- name: Get latest tag
id: tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name')
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Generate release notes to file
env:
GREN_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gren changelog \
--repo ${{ github.repository }} \
--tag ${{ steps.tag.outputs.tag }} \
> release-notes.md
- name: Create branch
run: |
git checkout -b release-notes-${{ steps.tag.outputs.tag }}
- name: Commit file
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add release-notes.md
git commit -m "Add release notes for ${{ steps.tag.outputs.tag }}"
- name: Push branch
run: |
git push origin release-notes-${{ steps.tag.outputs.tag }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "Release notes for ${{ steps.tag.outputs.tag }}" \
--body "Auto-generated release notes for tag ${{ steps.tag.outputs.tag }}" \
--head release-notes-${{ steps.tag.outputs.tag }} \
--base main