2026-02-10, Version 25.6.1 (Current) #208
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Linters (release proposals) | |
| on: | |
| push: | |
| branches: | |
| - v[0-9]+.[0-9]+.[0-9]+-proposal | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| PYTHON_VERSION: '3.14' | |
| NODE_VERSION: lts/* | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-release-commit: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - name: Lint release commit title format | |
| run: | | |
| EXPECTED_TITLE='^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}, Version [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ (\(Current|'.+' \(LTS)\)$' | |
| echo "Expected commit title format: $EXPECTED_TITLE" | |
| COMMIT_SUBJECT="$(git --no-pager log -1 --format=%s)" | |
| echo "Actual: $ACTUAL" | |
| echo "$COMMIT_SUBJECT" | grep -q -E "$EXPECTED_TITLE" | |
| echo "COMMIT_SUBJECT=$COMMIT_SUBJECT" >> "$GITHUB_ENV" | |
| - name: Lint release commit message trailers | |
| run: | | |
| EXPECTED_TRAILER="^$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/[[:digit:]]+\$" | |
| echo "Expected trailer format: $EXPECTED_TRAILER" | |
| PR_URL="$(git --no-pager log -1 --format='%(trailers:key=PR-URL,valueonly)')" | |
| echo "Actual: $PR_URL" | |
| echo "$PR_URL" | grep -E -q "$EXPECTED_TRAILER" | |
| PR_HEAD="$(gh pr view "$PR_URL" --json headRefOid -q .headRefOid)" | |
| echo "Head of $PR_URL: $PR_HEAD" | |
| echo "Current commit: $GITHUB_SHA" | |
| [ "$PR_HEAD" = "$GITHUB_SHA" ] | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Verify it's release-ready | |
| run: | | |
| SKIP_XZ=1 make release-only | |
| - name: Lint release commit content | |
| run: | | |
| MAJOR="$(awk '/^#define NODE_MAJOR_VERSION / { print $3 }' src/node_version.h)" | |
| echo "Checking for expected files in the release commit:" | |
| missing_expected= | |
| for expected in CHANGELOG.md src/node_version.h doc/changelogs/; do | |
| if git diff --exit-code --quiet --diff-filter=M HEAD^ -- "$expected"; then | |
| echo "Missing expected file in diff: $expected" | |
| missing_expected=1 | |
| fi | |
| done | |
| [ -z "$missing_expected" ] || exit 1 | |
| echo "Checking for unexpected files in the release commit:" | |
| set -ex | |
| [ -z "$(git diff-tree --no-commit-id --name-only -r HEAD --\ | |
| . \ | |
| ':(exclude)CHANGELOG.md' \ | |
| ':(exclude)src/node_version.h' \ | |
| ':(exclude)test/parallel/test-process-release.js' \ | |
| ':(exclude)doc/api/' \ | |
| ":(exclude)doc/changelogs/CHANGELOG_V$MAJOR.md")" ] | |
| - name: Validate CHANGELOG | |
| id: releaser-info | |
| run: | | |
| EXPECTED_CHANGELOG_TITLE_INTRO="## $COMMIT_SUBJECT, @" | |
| echo "Expected CHANGELOG section title: $EXPECTED_CHANGELOG_TITLE_INTRO" | |
| MAJOR="$(awk '/^#define NODE_MAJOR_VERSION / { print $3 }' src/node_version.h)" | |
| CHANGELOG_PATH="doc/changelogs/CHANGELOG_V${MAJOR}.md" | |
| CHANGELOG_TITLE="$(grep "$EXPECTED_CHANGELOG_TITLE_INTRO" "$CHANGELOG_PATH")" | |
| echo "Actual: $CHANGELOG_TITLE" | |
| [ "${CHANGELOG_TITLE%%@*}@" = "$EXPECTED_CHANGELOG_TITLE_INTRO" ] | |
| 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 | |
| DONT_LAND_LABEL="dont-land-on-v${MAJOR}.x" LTS_WATCH_LABEL="lts-watch-v${MAJOR}.x" gh pr view \ | |
| --json labels,url \ | |
| --jq ' | |
| if (.labels|any(.name==env.DONT_LAND_LABEL)) then | |
| error("\(.url) has the \(env.DONT_LAND_LABEL) label, forbidding it to be in this release proposal") | |
| elif (.labels|any(.name==env.LTS_WATCH_LABEL)) then | |
| error("\(.url) has the \(env.LTS_WATCH_LABEL) label, please remove the label now that the PR is included in a release proposal") | |
| end | |
| ' \ | |
| "$PR_URL" > /dev/null | |
| done | |
| shell: bash # See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference, we want the pipefail option. | |
| env: | |
| GH_TOKEN: ${{ github.token }} |