Skip to content

Commit a31805b

Browse files
committed
ci(workflows): [ci] add commitlint job
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent d139c70 commit a31805b

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

.github/workflows/ci.yml

+44-7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ env:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939
HUSKY: 0
4040
REF: ${{ github.head_ref || github.ref_name }}
41+
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
4142
concurrency:
4243
group: ${{ github.workflow }}-${{ github.ref }}
4344
cancel-in-progress: true
@@ -82,9 +83,35 @@ jobs:
8283
- id: version-typescript
8384
name: Get TypeScript version
8485
run: echo "result=$(jq .devDependencies.typescript package.json -r)" >> $GITHUB_OUTPUT
85-
gitguardian:
86+
commitlint:
8687
needs: metadata
8788
runs-on: ubuntu-latest
89+
steps:
90+
- id: checkout
91+
name: Checkout ${{ env.REF }}
92+
uses: actions/checkout@v3.3.0
93+
with:
94+
fetch-depth: 0
95+
ref: ${{ env.REF }}
96+
- id: node
97+
name: Setup Node.js
98+
uses: actions/setup-node@v3.6.0
99+
with:
100+
cache: yarn
101+
cache-dependency-path: yarn.lock
102+
node-version-file: .nvmrc
103+
- id: cache
104+
name: Restore dependencies cache
105+
uses: actions/cache@v3.2.6
106+
with:
107+
key: ${{ runner.os }}-${{ github.run_id }}
108+
path: ${{ env.CACHE_PATH }}
109+
- id: lint
110+
name: Check commitlint status
111+
run: yarn commitlint --from $SHA~${{ github.event.pull_request.commits || 1 }} --to $SHA
112+
gitguardian:
113+
needs: commitlint
114+
runs-on: ubuntu-latest
88115
steps:
89116
- id: checkout
90117
name: Checkout ${{ env.REF }}
@@ -104,7 +131,9 @@ jobs:
104131
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
105132
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
106133
format:
107-
needs: gitguardian
134+
needs:
135+
- commitlint
136+
- gitguardian
108137
runs-on: ubuntu-latest
109138
steps:
110139
- id: checkout
@@ -129,7 +158,9 @@ jobs:
129158
name: Check code formatting
130159
run: yarn check:format
131160
lint:
132-
needs: gitguardian
161+
needs:
162+
- commitlint
163+
- gitguardian
133164
runs-on: ubuntu-latest
134165
steps:
135166
- id: checkout
@@ -154,7 +185,9 @@ jobs:
154185
name: Check lint status
155186
run: yarn check:lint
156187
spelling:
157-
needs: gitguardian
188+
needs:
189+
- commitlint
190+
- gitguardian
158191
runs-on: ubuntu-latest
159192
steps:
160193
- id: checkout
@@ -180,6 +213,7 @@ jobs:
180213
run: yarn check:spelling
181214
typescript:
182215
needs:
216+
- commitlint
183217
- gitguardian
184218
- metadata
185219
runs-on: ubuntu-latest
@@ -224,7 +258,9 @@ jobs:
224258
name: Run typecheck
225259
run: yarn typecheck
226260
test:
227-
needs: gitguardian
261+
needs:
262+
- commitlint
263+
- gitguardian
228264
runs-on: ubuntu-latest
229265
strategy:
230266
fail-fast: false
@@ -266,18 +302,19 @@ jobs:
266302
flags: ${{ format('node{0}', matrix.node-version) }}
267303
override_branch: ${{ env.REF }}
268304
override_build: ${{ github.run_id }}
269-
override_commit: ${{ env.GITHUB_SHA }}
305+
override_commit: ${{ env.SHA }}
270306
token: ${{ secrets.CODECOV_TOKEN }}
271307
verbose: true
272308
env:
273309
GITHUB_JOB: ${{ github.job }}
274310
GITHUB_REF: ${{ github.ref }}
275311
GITHUB_REF_TYPE: ${{ github.ref_type }}
276312
GITHUB_RUN_ID: ${{ github.run_id }}
277-
GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
313+
GITHUB_SHA: ${{ env.SHA }}
278314
GITHUB_WORKSPACE: ${{ github.workspace }}
279315
build:
280316
needs:
317+
- commitlint
281318
- gitguardian
282319
- metadata
283320
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)