#!/bin/sh set -xe GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-nodejs/node} BOT_TOKEN=${BOT_TOKEN:-} RELEASE_DATE=$1 RELEASE_LINE=$2 RELEASER=$3 if [ -z "$RELEASE_DATE" ] || [ -z "$RELEASE_LINE" ]; then echo "Usage: $0 " exit 1 fi if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$BOT_TOKEN" ]; then echo "Invalid value in env for GITHUB_REPOSITORY and BOT_TOKEN" exit 1 fi if ! command -v node || ! command -v gh || ! command -v git || ! command -v awk; then echo "Missing required dependencies" exit 1 fi git node release --prepare --skipBranchDiff --yes --releaseDate "$RELEASE_DATE" HEAD_BRANCH="$(git rev-parse --abbrev-ref HEAD)" HEAD_SHA="$(git rev-parse HEAD^)" TITLE="$(git log -1 --format=%s)" # Use a temporary file for the PR body TEMP_BODY="$(awk "/## ${RELEASE_DATE}/,/^ ({ path, contents: readFileSync(path).toString('base64') })), deletions: deletedFiles.split('\n').filter(Boolean), } }, }) }); if (!response.ok) { console.log({statusCode: response.status, statusText: response.statusText}); process.exitCode ||= 1; } const data = await response.json(); if (data.errors?.length) { throw new Error('Endpoint returned an error', { cause: data }); } console.log(util.inspect(data, { depth: Infinity })); EOF gh pr edit "$PR_URL" --add-label release --add-label "v$RELEASE_LINE.x" --add-assignee "$RELEASER"