update-release-notes #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update release notes | |
on: | |
repository_dispatch: | |
types: [update-release-notes] | |
jobs: | |
update-release-notes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- run: | | |
mkdir -p ${{ github.workspace }}/content/${{ github.event.client_payload.product }}/release-notes/ | |
- name: Create release notes list | |
id: release-note-list | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const templatePath = '${{ github.workspace }}/.github/templates/template.md'; | |
const filePath = '${{ github.workspace }}/content/${{ github.event.client_payload.product }}/release-notes/${{ github.event.client_payload.application-name }}-${{ github.event.client_payload.sha }}.md'; | |
const templateFile = fs.readFileSync(templatePath, 'utf8'); | |
const fileContent = templateFile | |
.replace('<title>', '${{ github.event.client_payload.application-name }}-${{ github.event.client_payload.sha }}') | |
.replace('<date>', '${{ github.event.client_payload.date }}') | |
.replace('<issues>', `\n${{ github.event.client_payload.release-notes }}`); | |
fs.writeFileSync(filePath, fileContent, 'utf8'); | |
- name: Create release notes pull request | |
id: create-pull-request | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # [email protected] | |
with: | |
commit-message: "New release notes for ${{ github.event.client_payload.application-name }}" | |
branch: release-notes-${{ github.event.client_payload.application-name }} | |
branch-suffix: random | |
title: "New release notes for ${{ github.event.client_payload.application-name }}" | |
delete-branch: true |