From f68eb211ae837625c6db5bd95eb83213c049dcdf Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 22 Jun 2021 21:37:21 +0200 Subject: [PATCH] build: fix commit linter on unrebased PRs The commit linter was checking out the PR HEAD commit instead of merge/rebase commit, causing it to fail for any PRs that were not rebased on our default branch. --- .github/workflows/commit-lint.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml index 6673f2942da89f..782565d5488d80 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -2,6 +2,9 @@ name: "Commit messages adheres to guidelines at https://goo.gl/p2fr5Q" on: [pull_request] +env: + NODE_VERSION: 14.x + jobs: lint-commit-message: runs-on: ubuntu-latest @@ -9,12 +12,14 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.head.sha }} - # Last 100 commits should be enough for a PR - fetch-depth: 100 - - name: Use Node.js 12 - uses: actions/setup-node@v1 + fetch-depth: ${{ github.event.pull_request.commits }} + 1 + - name: Download problem matcher from HEAD + # This is needed for PR that have not been rebased. + run: curl -L https://github.com/nodejs/node/raw/HEAD/.github/workflows/commit-lint-problem-matcher.json > .github/workflows/commit-lint-problem-matcher.json + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: ${{ env.NODE_VERSION }} - name: Validate commit messages run: | echo "::add-matcher::.github/workflows/commit-lint-problem-matcher.json"