-
-
Notifications
You must be signed in to change notification settings - Fork 0
26 lines (24 loc) · 994 Bytes
/
release-changelog.yaml
File metadata and controls
26 lines (24 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
name: Regenerate release notes
on:
release:
types: [published]
permissions: {}
jobs:
regenerate:
if: github.repository_owner == 'jkroepke'
name: 'regenerate'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Update notes
#language=bash
run: |
TAG="${GITHUB_REF_NAME}"
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
NEW_NOTES=$(gh api --method POST -H "Accept: application/vnd.github+json" "/repos/${{ github.repository }}/releases/generate-notes" -f "tag_name=${GITHUB_REF_NAME}" | jq -r '.body')
RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" "/repos/${{ github.repository }}/releases/tags/${GITHUB_REF_NAME}" | jq -r '.id')
gh api --method PATCH -H "Accept: application/vnd.github+json" "/repos/${{ github.repository }}/releases/${RELEASE_ID}" -f "body=$NEW_NOTES"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}