add actions and jobs for automatic updates #38
25
flake-parts/action-create-pr/default.nix
Normal file
25
flake-parts/action-create-pr/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
perSystem =
|
||||||
|
{ config
|
||||||
|
, pkgs
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
name = builtins.baseNameOf ./.;
|
||||||
|
script = config.writers.writePureShellScriptBin
|
||||||
|
name
|
||||||
|
[
|
||||||
|
pkgs.bash
|
||||||
|
pkgs.coreutils
|
||||||
|
pkgs.git
|
||||||
|
pkgs.tea
|
||||||
|
pkgs.openssh
|
||||||
|
]
|
||||||
|
''
|
||||||
|
bash ${./script.sh} "$@"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.${name} = script;
|
||||||
|
};
|
||||||
|
}
|
17
flake-parts/action-create-pr/script.sh
Normal file
17
flake-parts/action-create-pr/script.sh
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
REMOTE_BRANCH="${REMOTE_BRANCH:-auto-pr}"
|
||||||
|
PR_TITLE="${PR_TITLE:-'This PR was created automatically'}"
|
||||||
|
|
||||||
|
git diff --quiet || {
|
||||||
|
echo -e "\e[31mWorking tree is dirty, please commit first\e[0m"
|
||||||
|
git status
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
git push origin "HEAD:$REMOTE_BRANCH"
|
||||||
|
|
||||||
|
tea pr create "$@" \
|
||||||
|
--head "$REMOTE_BRANCH" \
|
||||||
|
--title "$PR_TITLE"
|
|
@ -43,7 +43,7 @@
|
||||||
inputs.treefmt-nix.flakeModule
|
inputs.treefmt-nix.flakeModule
|
||||||
inputs.clan-core.modules.flake-parts.writers
|
inputs.clan-core.modules.flake-parts.writers
|
||||||
./flake-parts/action-flake-update
|
./flake-parts/action-flake-update
|
||||||
./flake-parts/action-open-pull-request
|
./flake-parts/action-create-pr
|
||||||
./targets/flake-module.nix
|
./targets/flake-module.nix
|
||||||
./modules/flake-module.nix
|
./modules/flake-module.nix
|
||||||
./pkgs/flake-module.nix
|
./pkgs/flake-module.nix
|
||||||
|
|
Loading…
Reference in New Issue
Block a user