merge-after-ci: rewrite according to #814 #882

Merged
clan-bot merged 4 commits from DavHau-dave into main 2024-02-27 11:35:26 +00:00
2 changed files with 49 additions and 18 deletions
Showing only changes of commit 398a61acbc - Show all commits

View File

@ -1,26 +1,33 @@
{ writeShellApplication { bash
, callPackage
, coreutils , coreutils
, bash
, git , git
, tea , lib
, nix
, openssh , openssh
, tea
, tea-create-pr , tea-create-pr
, ... , ...
}: }:
writeShellApplication { let
name = "merge-after-ci"; writers = callPackage ../builders/script-writers.nix { };
runtimeInputs = [ in
bash writers.writePython3Bin "merge-after-ci"
coreutils {
git makeWrapperArgs = [
tea "--prefix"
openssh "PATH"
tea-create-pr ":"
(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,
]
)