Skip to content

Commit

Permalink
ci: add pre-commit workflow (#339)
Browse files Browse the repository at this point in the history
Add a workflow that checks if all pre-commit checks pass or not.
This includes pre-commit and conform.
  • Loading branch information
OGKevin authored Mar 11, 2024
1 parent e93f882 commit eca263e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 23 deletions.
47 changes: 24 additions & 23 deletions .conform.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
policies:
- type: commit
spec:
header:
length: 89
imperative: true
case: lower
invalidLastCharacters: .
body:
required: true
dco: false
gpg:
required: true
spellcheck:
locale: US
maximumOfOneCommit: false
conventional:
types:
- feat
- fix
- chore
- deps
- docs
descriptionLength: 72
- type: commit
spec:
header:
length: 89
imperative: true
case: lower
invalidLastCharacters: .
body:
required: true
dco: false
gpg:
required: true
spellcheck:
locale: US
maximumOfOneCommit: false
conventional:
types:
- feat
- fix
- chore
- deps
- docs
- ci
descriptionLength: 72
32 changes: 32 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "pre-commit"
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
USER: runner
steps:
- name: install packages
run: sudo apt-get update && sudo apt-get install -y curl xz-utils git
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: cachix/install-nix-action@v26
- uses: DeterminateSystems/magic-nix-cache-action@v3
- name: Install devenv.sh
run: nix profile install tarball+https://install.devenv.sh/latest
- name: Pre Commit
shell: devenv shell bash -e {0}
run: pre-commit run -s HEAD~1 -o HEAD
conform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Conform Action
uses: siderolabs/[email protected]
2 changes: 2 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
vault
nodejs-slim
awscli2
conform
];

languages.javascript = {
Expand All @@ -23,6 +24,7 @@
pre-commit.hooks = {
eslint.enable = true;
actionlint.enable = true;
conform.enable = true;
};

# https://devenv.sh/scripts/
Expand Down

0 comments on commit eca263e

Please sign in to comment.