Skip to content

Commit

Permalink
fix: error on first commit (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
ateoi authored Jun 15, 2023
1 parent fc0b524 commit 23c3cfc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ jobs:
node --version
npm --version
npx commitlint --version
- name: Get commit count
id: commit_count
run: echo "commit_count=$(git rev-list HEAD --count)" >>$GITHUB_OUTPUT
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
if: github.event_name == 'push' && steps.commit_count.outputs.commit_count > 1
run: npx commitlint --from HEAD~1 --to HEAD --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 comments on commit 23c3cfc

Please sign in to comment.