diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index c35f4ddc11b2c9..9bb9cd14bc1d0f 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -105,5 +105,5 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 2 - # GH Actions squash all commits into one, HEAD^ refers to the base branch. + # GH Actions squashes all PR commits, HEAD^ refers to the base branch. - run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }} diff --git a/tools/lint-pr-url.mjs b/tools/lint-pr-url.mjs index 5f6781b21dd889..3b491d26e389cb 100755 --- a/tools/lint-pr-url.mjs +++ b/tools/lint-pr-url.mjs @@ -13,11 +13,11 @@ const fileDelimiter = /^\+\+\+ b\/(.+\.md)$/; const changeDelimiter = /^@@ -\d+,\d+ \+(\d+),\d+ @@/; const prUrlDefinition = /^\+\s+pr-url: (.+)$/; +const validatePrUrl = (url) => url == null || url === expectedPrUrl; + let currentFile; let currentLine; -const validatePrUrl = (url) => url == null || url === expectedPrUrl; - const diff = readline.createInterface({ input: process.stdin }); for await (const line of diff) { if (fileDelimiter.test(line)) {