Skip to content

Commit e846dfa

Browse files
committed
ci: run commitlint to check commits (#1602)
As first step in our main "check" workflows (push, linux, mac, windows), check all the commit messages with commitlint. These workflows can be triggered in various ways: pull requests, pushes, manually, or scheduled. For (each push to) a pull request, all commits currently in the PR branch are checked. For a regular push, all the pushed commits are checked. For a manual run, it seemed to check the same commits as a push (which push ? Not sure how this works). For a scheduled run - we'll see.
1 parent f7f88a4 commit e846dfa

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.github/workflows/linux.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,25 @@ jobs:
8787
with:
8888
fetch-depth: 0
8989

90+
#- name: Print debug output
91+
# env:
92+
# GITHUB_CONTEXT: ${{ toJson(github) }}
93+
# run: |
94+
# echo "$GITHUB_SHA"
95+
# echo "$GITHUB_REF"
96+
# echo "$GITHUB_HEAD_REF"
97+
# echo "$GITHUB_BASE_REF"
98+
# git log "$GITHUB_BASE_REF"..
99+
# bin/commitlint "$GITHUB_BASE_REF"..
100+
101+
- name: Check commit messages
102+
env:
103+
BEFORE: ${{ github.event.push.before }}
104+
# for a PR this will be: origin/master..origin/$GITHUB_HEAD_REF
105+
# for a push it will be: $BEFORE..
106+
run: |
107+
bin/commitlint ${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
108+
90109
# things to be cached/restored:
91110

92111
- name: Cache stack global package db

.github/workflows/mac.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ jobs:
5757
with:
5858
fetch-depth: 0
5959

60+
- name: Check commit messages
61+
# for a PR this will be: master..origin/$GITHUB_HEAD_REF
62+
# for a push it will be: master..
63+
run: |
64+
bin/commitlint origin/master..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
65+
6066
# things to be cached/restored:
6167

6268
- name: Cache stack global package db

.github/workflows/push.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ jobs:
5050
with:
5151
fetch-depth: 0
5252

53+
- name: Check commit messages
54+
# for a PR this will be: master..origin/$GITHUB_HEAD_REF
55+
# for a push it will be: master..
56+
run: |
57+
bin/commitlint origin/master..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
58+
5359
# things to be cached/restored:
5460

5561
- name: Cache stack global package db

.github/workflows/windows.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ jobs:
4747
with:
4848
fetch-depth: 0
4949

50+
- name: Check commit messages
51+
# for a PR this will be: master..origin/$GITHUB_HEAD_REF
52+
# for a push it will be: master..
53+
run: |
54+
bin/commitlint origin/master..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
55+
5056
# things to be cached/restored:
5157

5258
- name: Cache stack global package db

0 commit comments

Comments
 (0)