Skip to content

Commit

Permalink
GitHubCI: add commitlint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Oct 23, 2022
1 parent 94beb29 commit 94b0133
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ on: [push, pull_request]

jobs:

style:
sanity_check:
needs: [macOS, linux, windows]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
# needed because of commit-lint, see https://github.com/conventional-changelog/commitlint/issues/3376
fetch-depth: 0

- name: Install dependencies of commitlint
run: sudo apt install --yes npm && npm install @commitlint/config-conventional
- name: Pull our commitlint configuration
run: sudo apt install wget && wget https://raw.githubusercontent.com/nblockchain/conventions/master/commitlint.config.ts
- name: Validate current commit (last commit) with commitlint
run: npx commitlint --from HEAD~1 --to HEAD --verbose

- name: Setup .NET SDK 5.0.x
uses: actions/[email protected]
with:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint commit messages

on: pull_request

jobs:
commitlint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies of commitlint
run: sudo apt install --yes npm && npm install @commitlint/config-conventional
- name: Pull our commitlint configuration
run: sudo apt install --yes wget && wget https://raw.githubusercontent.com/nblockchain/conventions/master/commitlint.config.ts
- name: Validate all commits from PR
run: |
echo 'Going to run commitlint for ${{ github.event.pull_request.commits }} commits'
npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ https://github.com/nblockchain/fantomless/commit/138146e3e8fc7e8d9d8404ef9956ace
For reference on how we like commit messages to be formatted, and other
recommendations, please read our
[Workflow guidelines](https://github.com/nblockchain/conventions/blob/master/WorkflowGuidelines.md).
We even have a CI step that checks for common mistakes in commit messages,
based on a tool called 'commitlint'.

0 comments on commit 94b0133

Please sign in to comment.