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

@nodejs-github-bot
Copy link
Copy Markdown
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
Comment thread .github/workflows/lint-release-proposal.yml Outdated
@aduh95 aduh95 requested a review from a team December 18, 2024 17:16
Comment thread .github/workflows/lint-release-proposal.yml Outdated
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 28, 2024
@aduh95
Copy link
Copy Markdown
Contributor Author

aduh95 commented Jan 8, 2025

@nodejs/releasers I'm planing on landing this later this week if I don't receive more feedback on it

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jan 9, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 9, 2025
@nodejs-github-bot nodejs-github-bot merged commit e1df1e0 into nodejs:main Jan 9, 2025
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in e1df1e0

@aduh95 aduh95 deleted the lint-release-commit-list branch January 9, 2025 22:42
targos pushed a commit that referenced this pull request Jan 13, 2025
PR-URL: #56291
Reviewed-By: James M Snell <jasnell@gmail.com>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Jan 13, 2025
PR-URL: nodejs#56291
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 added a commit that referenced this pull request Jan 30, 2025
PR-URL: #56291
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 added a commit that referenced this pull request Jan 31, 2025
PR-URL: #56291
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 added a commit that referenced this pull request Feb 4, 2025
PR-URL: #56291
Reviewed-By: James M Snell <jasnell@gmail.com>
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 4, 2025