feat(workflows/pre-commit): Check multiple stages

This commit is contained in:
Tom Hubrecht 2024-12-12 15:01:42 +01:00
parent 88d9b8c3e3
commit f5147dec8d
Signed by: thubrecht
SSH key fingerprint: SHA256:CYNvFo44Ar9qCNnWNnvJVhs0QXO9AZjOLlPeWcSij3Q
2 changed files with 18 additions and 10 deletions

View file

@ -1,9 +1,12 @@
jobs:
check:
pre-commit:
runs-on: nix
steps:
- uses: actions/checkout@v3
- name: Run pre-commit on all files
- name: Check stage pre-commit
run: nix-shell -A pre-commit --run 'pre-commit run --all-files --hook-stage
pre-commit --show-diff-on-failure'
- name: Check stage pre-push
run: nix-shell -A pre-commit --run 'pre-commit run --all-files --hook-stage
pre-push --show-diff-on-failure'
name: Run pre-commit on all files

View file

@ -9,14 +9,19 @@
"pull_request"
];
jobs.check = {
jobs.pre-commit = {
runs-on = "nix";
steps = [
{ uses = "actions/checkout@v3"; }
{
name = "Run pre-commit on all files";
run = "nix-shell -A pre-commit --run 'pre-commit run --all-files --hook-stage pre-push --show-diff-on-failure'";
}
];
steps =
[ { uses = "actions/checkout@v3"; } ]
++ (builtins.map
(stage: {
name = "Check stage ${stage}";
run = "nix-shell -A pre-commit --run 'pre-commit run --all-files --hook-stage ${stage} --show-diff-on-failure'";
})
[
"pre-commit"
"pre-push"
]
);
};
}