Skip to content

Commit 63171d7

Browse files
authored
chore: optimize the Conventional Commit Linter workflow (#1031)
1 parent 19b468a commit 63171d7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/commitlint.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ on:
66
- main
77
pull_request:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
commitlint:
1114
runs-on: ubuntu-latest
1215
steps:
13-
- uses: actions/checkout@v6
16+
- name: Compute number of commits to fetch
17+
id: nb-of-commits
18+
# `+ 1` for PRs because of the merge commit
19+
run: |
20+
echo "toParse=$(echo "$EVENT" | jq -r 'if .commits then (.commits | length) else (.pull_request.commits + 1) end')" >> $GITHUB_OUTPUT
21+
env:
22+
EVENT: ${{ toJSON(github.event) }}
23+
- name: Checkout
24+
uses: actions/checkout@v6
1425
with:
15-
fetch-depth: 100
26+
persist-credentials: false
27+
sparse-checkout: .
28+
fetch-depth: ${{ steps.nb-of-commits.outputs.toParse }}
1629
- uses: wagoid/commitlint-github-action@v6

0 commit comments

Comments
 (0)