GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools: don't use GH API for commit message checks · nodejs/node@691e1a6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools
    • lint-pr-commit-message.sh
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/lint-pr-commit-message.sh‎

Copy file name to clipboardExpand all lines: tools/lint-pr-commit-message.sh
+11-17Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,15 @@ if [ -z "${PR_ID}" ]; then
2525
echo " e.g. $0 <PR_NUMBER>"
2626
exit 1
2727
fi
28-
# Retrieve the first commit of the pull request via GitHub API
29-
# TODO: If we teach core-validate-commit to ignore "fixup!" and "squash!"
30-
# commits and lint messages for all commits in the pull request
31-
# we could simplify the following to:
32-
# npx -q core-validate-commit --no-validate-metadata ${GH_API_URL}/repos/nodejs/node/pulls/${PR_ID}/commits
33-
if PR_COMMITS="$( curl -s ${GH_API_URL}/repos/nodejs/node/pulls/${PR_ID}/commits )"; then
34-
if FIRST_COMMIT="$( node -p 'JSON.parse(process.argv[1])[0].url' "${PR_COMMITS}" 2> /dev/null )"; then
35-
echo "Linting the first commit message for pull request ${PR_ID}"
36-
echo "according to the guidelines at https://goo.gl/p2fr5Q."
37-
# Print the commit message to make it more obvious what is being checked.
38-
echo "Commit message for ${FIRST_COMMIT##*/} is:"
39-
node -p 'JSON.parse(process.argv[1])[0].commit.message' "${PR_COMMITS}" 2> /dev/null
40-
npx -q core-validate-commit --no-validate-metadata "${FIRST_COMMIT}"
41-
else
42-
echo "Unable to determine the first commit for pull request ${PR_ID}."
43-
exit 1
44-
fi
28+
29+
PATCH=$( curl -sL https://github.com/nodejs/node/pull/${PR_ID}.patch | grep '^From ' )
30+
if FIRST_COMMIT="$( echo "$PATCH" | awk '/^From [0-9a-f]{40} / { if (count++ == 0) print $2 }' )"; then
31+
MESSAGE=$( git show --quiet --format='format:%B' $FIRST_COMMIT )
32+
echo "
33+
*** Linting the first commit message for pull request ${PR_ID}
34+
*** according to the guidelines at https://goo.gl/p2fr5Q.
35+
*** Commit message for $(echo $FIRST_COMMIT | cut -c 1-10) is:
36+
${MESSAGE}
37+
"
38+
npx -q core-validate-commit --no-validate-metadata "${FIRST_COMMIT}"
4539
fi

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.