Skip to content

Commit

Permalink
fix: add commit linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kristof-mattei committed Dec 13, 2021
1 parent 70bc0fe commit 141820a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
path: |
~/.cargo
./target
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-cargotest
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-cargoversion
restore-keys: |
${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/lint-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint commits

on:
pull_request:
branches:
- main

concurrency:
# each new commit to a PR runs this workflow
# so we need to avoid a long running older one from overwriting the 'pr-<number>-latest'
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
cancel-in-progress: true

jobs:
lint-commits:
name: Lint commits
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
# we cannot use the actual merge as it is not a real commit yet
# so we get the tip of the PR
# and we protect ourselves from other changes by enforcing
# the branch to be up to date with main before merging
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up toolchain
shell: bash
run: |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none --profile minimal -y
# invoking this actually sets up the toolchain as per rust-toolchain.toml
cargo --version
- name: Cache dependencies
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
env:
CACHE_NAME: cargo-cache-dependencies
with:
path: |
~/.cargo
./target
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-cargococogitto
restore-keys: |
${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('Cargo.lock') }}-
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
- name: Install cocogitto for commit linting
run: |
cargo install --locked cocogitto;
- name: Check the commits
shell: bash
run: |
cog check
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

8 changes: 0 additions & 8 deletions .husky/pre-push

This file was deleted.

22 changes: 0 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@commitlint/config-conventional": "^15.0.0",
"@semantic-release/changelog": "^6.0.1",
"conventional-changelog-conventionalcommits": "^4.6.1",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"prettier": "^2.5.1",
"semantic-release": "^18.0.1",
Expand All @@ -37,6 +36,5 @@
},
"publishConfig": {
"access": "restricted"
},
"dependencies": {}
}
}

0 comments on commit 141820a

Please sign in to comment.