Skip to content

tools: validate commit list as part of lint-release-commit#56291

Merged
nodejs-github-bot merged 11 commits into
nodejs:mainfrom
aduh95:lint-release-commit-list
Jan 9, 2025
Merged

tools: validate commit list as part of lint-release-commit#56291
nodejs-github-bot merged 11 commits into
nodejs:mainfrom
aduh95:lint-release-commit-list

Conversation

@aduh95
Copy link
Copy Markdown
Contributor

@aduh95 aduh95 commented Dec 17, 2024

When updating manually a release proposal, it can be easy to have the commit list in the CHANGELOG and the actual list of commits in the proposal no longer in sync.
It will also double check that none of the commits being released comes from a PR with the dont-land-onvXX.x, in case the label was added after the commit was already backported.
I'm also switching to using make release-only which contains the checks we were doing and more.

You can test it locally while the v23.5.0 proposal is open:

#!/bin/bash

set -e
set -o pipefail

GITHUB_REPOSITORY=nodejs/node
MAJOR=22
GITHUB_SHA=7d849ab5e3ff707512c6d7e7031428dafe44a5aa # b0bd12384eca49202d2dd2b4971ee66d7f62f4a0
CHANGELOG_PATH="doc/changelogs/CHANGELOG_V${MAJOR}.md"

curl -L -o "$CHANGELOG_PATH" "https://github.com/nodejs/node/raw/$GITHUB_SHA/$CHANGELOG_PATH"

gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  --jq '.commits.[] | { smallSha: .sha[0:10] } + (.commit.message|capture("^(?<title>.+)\n\n(.*\n)*PR-URL: (?<prURL>.+)\n"))' \
  "/repos/${GITHUB_REPOSITORY}/compare/v${MAJOR}.x...$GITHUB_SHA" --paginate \
| node tools/actions/lint-release-proposal-commit-list.mjs "$CHANGELOG_PATH" "$GITHUB_SHA" \
| while IFS= read -r PR_URL; do
  LABEL="dont-land-on-v${MAJOR}.x" gh pr view \
    --json labels,url \
    --jq 'if (.labels|map(.name==env.LABEL)|any) then error("\(.url) has the \(env.LABEL) label, forbidding it to be in this release proposal") end' \
    "$PR_URL" > /dev/null
done

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. meta Issues and PRs related to the general management of the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants