merge-after-ci: rewrite according to #814
checks / check-links (pull_request) Successful in 22s Details
checks / checks-impure (pull_request) Successful in 1m58s Details
checks / checks (pull_request) Successful in 2m23s Details

This commit is contained in:
DavHau 2024-02-27 18:23:00 +07:00
parent fdedf40e27
commit 398a61acbc
2 changed files with 49 additions and 18 deletions

View File

@ -1,26 +1,33 @@
{ writeShellApplication
{ bash
, callPackage
, coreutils
, bash
, git
, tea
, lib
, nix
, openssh
, tea
, tea-create-pr
, ...
}:
writeShellApplication {
name = "merge-after-ci";
runtimeInputs = [
bash
coreutils
git
tea
openssh
tea-create-pr
let
writers = callPackage ../builders/script-writers.nix { };
in
writers.writePython3Bin "merge-after-ci"
{
makeWrapperArgs = [
"--prefix"
"PATH"
":"
(lib.makeBinPath [
bash
coreutils
git
nix
openssh
tea
tea-create-pr
])
];
text = ''
remoteName="''${1:-origin}"
targetBranch="''${2:-main}"
shift && shift
tea-create-pr "$remoteName" "$targetBranch" --assignees clan-bot "$@"
'';
}
./merge-after-ci.py

View File

@ -0,0 +1,24 @@
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("--reviewers", nargs="*")
parser.add_argument("--no-review", action="store_true")
parser.add_argument("args", nargs="*")
args = parser.parse_args()
# complain if neither --reviewers nor --no-review is given
if not args.reviewers and not args.no_review:
parser.error("either --reviewers or --no-review must be given")
subprocess.run(
[
"tea-create-pr",
"origin",
"main",
"--assignees",
"clan-bot",
*([*args.reviewers] if args.reviewers else []),
*args.args,
]
)