feat: Add local workflow
All checks were successful
Run pre-commit on all files / pre-push (push) Successful in 25s
All checks were successful
Run pre-commit on all files / pre-push (push) Successful in 25s
This commit is contained in:
parent
8815dfc28d
commit
829e83af9c
3 changed files with 64 additions and 16 deletions
12
.forgejo/workflows/pre-commit.yaml
Normal file
12
.forgejo/workflows/pre-commit.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
jobs:
|
||||
pre-push:
|
||||
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'
|
||||
name: Run pre-commit on all files
|
||||
'on':
|
||||
- pull_request
|
||||
- push
|
|
@ -2,7 +2,7 @@ version = 1
|
|||
[[annotations]]
|
||||
SPDX-FileCopyrightText = "NONE"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
path = [".envrc", ".gitignore", "shell.nix"]
|
||||
path = [".envrc", ".forgejo/workflows/*.yaml", ".gitignore", "shell.nix"]
|
||||
precedence = "closest"
|
||||
|
||||
[[annotations]]
|
||||
|
|
66
default.nix
66
default.nix
|
@ -8,7 +8,9 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib mkShell;
|
||||
inherit (pkgs) mkShell;
|
||||
|
||||
inherit (pkgs.lib) evalModules getExe recursiveUpdate;
|
||||
|
||||
inherit (pkgs.lib.fileset) gitTracked toSource;
|
||||
|
||||
|
@ -52,6 +54,7 @@ let
|
|||
|
||||
generatedPaths = [
|
||||
".envrc"
|
||||
".forgejo/workflows/*.yaml"
|
||||
".gitignore"
|
||||
"shell.nix"
|
||||
];
|
||||
|
@ -65,24 +68,11 @@ let
|
|||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
devShell = mkShell {
|
||||
name = "nix-actions.dev";
|
||||
|
||||
packages = git-checks.enabledPackages;
|
||||
|
||||
shellHook = builtins.concatStringsSep "\n" [
|
||||
git-checks.shellHook
|
||||
reuse.shellHook
|
||||
];
|
||||
};
|
||||
|
||||
install =
|
||||
{ src, ... }@config:
|
||||
let
|
||||
project = lib.evalModules {
|
||||
project = evalModules {
|
||||
modules = [
|
||||
./modules
|
||||
{
|
||||
|
@ -107,6 +97,52 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
workflows = install {
|
||||
src = ./.;
|
||||
|
||||
buildCheck = false;
|
||||
|
||||
workflows.pre-commit = {
|
||||
name = "Run pre-commit on all files";
|
||||
on = [
|
||||
"pull_request"
|
||||
"push"
|
||||
];
|
||||
|
||||
jobs.pre-push = {
|
||||
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'";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
devShell = mkShell {
|
||||
name = "nix-actions.dev";
|
||||
|
||||
packages = git-checks.enabledPackages;
|
||||
|
||||
shellHook = builtins.concatStringsSep "\n" [
|
||||
git-checks.shellHook
|
||||
reuse.shellHook
|
||||
workflows.shellHook
|
||||
];
|
||||
|
||||
passthru.pre-commit = mkShell {
|
||||
name = "pre-commit";
|
||||
inherit (git-checks) shellHook;
|
||||
};
|
||||
};
|
||||
|
||||
inherit install;
|
||||
|
||||
lib = rec {
|
||||
expr = repr: "\${{ ${repr} }}";
|
||||
secret = name: expr "secrets.${name}";
|
||||
|
|
Loading…
Reference in a new issue