forked from clan/clan-infra
action-checkout: init
This commit is contained in:
parent
7f2982bb66
commit
119423deb5
24
flake-parts/action-checkout/default.nix
Normal file
24
flake-parts/action-checkout/default.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
perSystem =
|
||||
{ config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
name = builtins.baseNameOf ./.;
|
||||
script = config.writers.writePureShellScriptBin
|
||||
name
|
||||
[
|
||||
pkgs.bash
|
||||
pkgs.coreutils
|
||||
pkgs.git
|
||||
pkgs.openssh
|
||||
]
|
||||
''
|
||||
bash ${./script.sh}
|
||||
'';
|
||||
in
|
||||
{
|
||||
packages.${name} = script;
|
||||
};
|
||||
}
|
10
flake-parts/action-checkout/script.sh
Normal file
10
flake-parts/action-checkout/script.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# load BRANCH variable with default
|
||||
BRANCH=${BRANCH:-main}
|
||||
|
||||
# load REPO_DIR variable with default
|
||||
export REPO_DIR=${REPO_DIR:-.}
|
||||
|
||||
git clone --depth 1 --branch $BRANCH $REPO $REPO_DIR
|
Loading…
Reference in New Issue
Block a user