From e661bcb7f7dfc7dd3fb418379ccfee4b224b325c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 23 Jun 2021 16:48:34 +0200 Subject: [PATCH] tools: avoid fetch extra commits when validating commit messages --- .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 9ea6337b51f181..ca3df6e3b08df7 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -2,18 +2,23 @@ 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 steps: + - name: Compute number of commits in the PR + id: nb-of-commits + run: echo "::set-output name=nb::$((${{ github.event.pull_request.commits }} + 1))" - uses: actions/checkout@v2 with: - # Last 100 commits should be enough for a PR - fetch-depth: 100 - - name: Use Node.js 12 - uses: actions/setup-node@v1 + fetch-depth: ${{ steps.nb-of-commits.outputs.nb }} + - 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"