From 89033983a6567ea174a71c687efda146d3d6e846 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 20 May 2024 14:48:15 -0400 Subject: [PATCH 1/2] chore(NODE-5388): add release automation --- .github/scripts/highlights.mjs | 76 + .github/scripts/pr_list.mjs | 32 + .github/scripts/release_notes.mjs | 51 + .github/scripts/util.mjs | 47 + .github/workflows/CI.yml | 54 +- .github/workflows/release_notes.yml | 80 + .release-please-manifest.json | 3 + package-lock.json | 3764 ++------------------------- package.json | 3 +- release-please-config.json | 16 + 10 files changed, 531 insertions(+), 3595 deletions(-) create mode 100644 .github/scripts/highlights.mjs create mode 100644 .github/scripts/pr_list.mjs create mode 100644 .github/scripts/release_notes.mjs create mode 100644 .github/scripts/util.mjs create mode 100644 .github/workflows/release_notes.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/scripts/highlights.mjs b/.github/scripts/highlights.mjs new file mode 100644 index 0000000..64363c4 --- /dev/null +++ b/.github/scripts/highlights.mjs @@ -0,0 +1,76 @@ +// @ts-check +import * as process from 'node:process'; +import { output } from './util.mjs'; + +const { + GITHUB_TOKEN = '', + PR_LIST = '', + REPOSITORY = '' +} = process.env; +if (GITHUB_TOKEN === '') throw new Error('GITHUB_TOKEN cannot be empty'); +if (REPOSITORY === '') throw new Error('REPOSITORY cannot be empty') + +const API_REQ_INFO = { + headers: { + Accept: 'application/vnd.github.v3+json', + 'X-GitHub-Api-Version': '2022-11-28', + Authorization: `Bearer ${GITHUB_TOKEN}` + } +} + +const prs = PR_LIST.split(',').map(pr => { + const prNum = Number(pr); + if (Number.isNaN(prNum)) + throw Error(`expected PR number list: ${PR_LIST}, offending entry: ${pr}`); + return prNum; +}); + +/** @param {number} pull_number */ +async function getPullRequestContent(pull_number) { + const startIndicator = 'RELEASE_HIGHLIGHT_START -->'; + const endIndicator = '