infrastructure/workflows/pre-commit.nix

27 lines
589 B
Nix

# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
name = "Run pre-commit on all files";
on = [
"push"
"pull_request"
];
jobs.pre-commit = {
runs-on = "nix";
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"
]
);
};
}