Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

aduh95
Copy link
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

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Dec 17, 2024
@aduh95 aduh95 requested a review from a team December 18, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants