action-create-pr: init

This commit is contained in:
DavHau 2023-07-26 18:30:19 +02:00
parent 53b5671d00
commit 2f15217d81
3 changed files with 44 additions and 1 deletions

View 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;
};
}

View File

@ -0,0 +1,18 @@
#!/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" \
--labels "0.kind: automation" \
--title "$PR_TITLE"

View File

@ -43,7 +43,7 @@
inputs.treefmt-nix.flakeModule
inputs.clan-core.modules.flake-parts.writers
./flake-parts/action-flake-update
./flake-parts/action-open-pull-request
./flake-parts/action-create-pr
./targets/flake-module.nix
./modules/flake-module.nix
./pkgs/flake-module.nix