-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.86 KB
/
update-release-notes.yaml
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
27
28
29
30
31
32
33
34
35
36
37
38
39
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