Skip to content

Commit e661bcb

Browse files
committed
tools: avoid fetch extra commits when validating commit messages
1 parent 84d6ce9 commit e661bcb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/commit-lint.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@ name: "Commit messages adheres to guidelines at https://goo.gl/p2fr5Q"
22

33
on: [pull_request]
44

5+
env:
6+
NODE_VERSION: 14.x
7+
58
jobs:
69
lint-commit-message:
710
runs-on: ubuntu-latest
811
steps:
12+
- name: Compute number of commits in the PR
13+
id: nb-of-commits
14+
run: echo "::set-output name=nb::$((${{ github.event.pull_request.commits }} + 1))"
915
- uses: actions/checkout@v2
1016
with:
11-
# Last 100 commits should be enough for a PR
12-
fetch-depth: 100
13-
- name: Use Node.js 12
14-
uses: actions/setup-node@v1
17+
fetch-depth: ${{ steps.nb-of-commits.outputs.nb }}
18+
- name: Use Node.js ${{ env.NODE_VERSION }}
19+
uses: actions/setup-node@v2
1520
with:
16-
node-version: 12.x
21+
node-version: ${{ env.NODE_VERSION }}
1722
- name: Validate commit messages
1823
run: |
1924
echo "::add-matcher::.github/workflows/commit-lint-problem-matcher.json"

0 commit comments

Comments
 (0)