-
-
Notifications
You must be signed in to change notification settings - Fork 182
37 lines (34 loc) · 1.46 KB
/
generate-changelog.yml
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
name: Generate Changelog
on: workflow_dispatch
permissions:
contents: read
jobs:
generate_changelog:
name: 'Generate Changelog'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Configure GIT
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Generate Changelog
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const {run} = require('./.github/workflows/scripts/generate-changelog.cjs');
const {branchName, commitName, content, errors, changelogs} = await run();
const owner = context.payload.repository.owner.login;
const repo = context.payload.repository.name;
const title = commitName;
const head = branchName;
const base = 'main';
const bodyChangelogs = changelogs.map(c => `- ${c}`).join('\n');
const bodyErrors = errors.length !== 0 ? `Got the following errors:\n${errors.map(e => `- ${e}`).join('\n')}` : '';
const body = `Resulting CHANGELOG at:\n${bodyChangelogs}\n\n${bodyErrors}`
await github.rest.pulls.create({owner, repo, title, head, base, body});