Skip to content

Commit 1291424

Browse files
committed
chore: make commitlint work locally and in CI
1 parent f3c5e14 commit 1291424

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
1921

2022
- name: Setup Node.js
2123
uses: actions/setup-node@v4
@@ -40,6 +42,9 @@ jobs:
4042

4143
- name: Run standards checks
4244
run: npm run standards
45+
env:
46+
# For PRs: lint from base branch. For pushes: lint from previous commit
47+
COMMITLINT_FROM: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
4348

4449
- name: Run cargo check
4550
run: cargo check --workspace --all-targets

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"build": "tsc -p guest-js/tsconfig.json",
1313
"check-node-version": "check-node-version --npm 10.5.0",
14-
"commitlint": "commitlint --from 002bcc8",
14+
"commitlint": "commitlint --from ${COMMITLINT_FROM:-002bcc8} --to ${COMMITLINT_TO:-HEAD}",
1515
"markdownlint": "markdownlint-cli2",
1616
"rust:lint": "cargo lint-clippy && cargo lint-fmt",
1717
"rust:lint:fix": "cargo fix-clippy && cargo fix-fmt",

0 commit comments

Comments
 (0)