From b8fb75121b3f1eb322ca741cdb6f3d084288302d Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Tue, 22 Jun 2021 14:07:30 -0400 Subject: [PATCH] tools: remove unused `lint-pr-commit-message.sh` `tools/lint-pr-commit-message.sh` was previously used to lint the commit message of the first commit in a pull request but is now no longer used -- commit message linting is now done in a GitHub actions workflow which does not call this script. PR-URL: https://github.com/nodejs/node/pull/39120 Reviewed-By: Mary Marchini Reviewed-By: Luigi Pinca Reviewed-By: Jiawen Geng Reviewed-By: Darshan Sen Reviewed-By: Zijian Liu --- tools/lint-pr-commit-message.sh | 39 --------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 tools/lint-pr-commit-message.sh diff --git a/tools/lint-pr-commit-message.sh b/tools/lint-pr-commit-message.sh deleted file mode 100644 index 443e64469d3b24..00000000000000 --- a/tools/lint-pr-commit-message.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# Shell script to lint the message of the first commit in a pull request. -# -# Depends on curl, git, node, npm and npx being in $PATH. -# -# The pull request is either: -# 1) supplied as an argument to this shell script -# 2) derived from the HEAD commit via the GitHub API - -GH_API_URL="https://api.github.com" -PR_ID=$1; -if [ -z "${PR_ID}" ]; then - # Attempt to work out the PR number based on current HEAD - if HEAD_COMMIT="$( git rev-parse HEAD )"; then - if SEARCH_RESULTS="$( curl -s "${GH_API_URL}/search/issues?q=sha:${HEAD_COMMIT}+type:pr+repo:nodejs/node" )"; then - if FOUND_PR="$( node -p 'JSON.parse(process.argv[1]).items[0].number' "${SEARCH_RESULTS}" 2> /dev/null )"; then - PR_ID=${FOUND_PR} - fi - fi - fi -fi -if [ -z "${PR_ID}" ]; then - echo "Unable to determine the pull request number to check. Please specify, " - echo " e.g. $0 " - exit 1 -fi - -PATCH=$( curl -sL "https://github.com/nodejs/node/pull/${PR_ID}.patch" | grep '^From ' ) -if FIRST_COMMIT="$( echo "$PATCH" | awk '/^From [0-9a-f]{40} / { if (count++ == 0) print $2 }' )"; then - MESSAGE=$( git show --quiet --format='format:%B' "$FIRST_COMMIT" ) - echo " -*** Linting the first commit message for pull request ${PR_ID} -*** according to the guidelines at https://goo.gl/p2fr5Q. -*** Commit message for $(echo "$FIRST_COMMIT" | cut -c 1-10) is: -${MESSAGE} -" - npx -q core-validate-commit --no-validate-metadata "${FIRST_COMMIT}" -fi