Skip to content

Commit

Permalink
chore: include script for ff merging prs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Feb 24, 2025
1 parent 6e8f5d0 commit a63649b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,43 @@
2>&1 echo "Usage: git-subtree <subtree> <command> <ref>"
esac
'';
pr-merge-ff-cmd =
pkgs.writeShellScriptBin "pr-merge-ff"
/*
bash
*/
''
set -e
if ! ${lib.getExe pkgs.gh} pr checks ; then
2>&1 echo "PR checks have not (yet) passed"
exit 1
fi
BASE=main
DELETE=false
case "$1" in
"-d")
DELETE=true
;;
*)
echo "setting base branch to $1"
BASE="$1"
esac
BRANCH=$(git rev-parse --abbref-ref HEAD)
git switch "$BASE"
git merge --ff-only "$BRANCH"
if $DELETE ; then
git branch -d "$BRANCH"
fi
git push
'';
in
pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} rec {
inherit (self.checks.${system}.pre-commit-check) shellHook;
Expand All @@ -99,6 +136,7 @@
maturin
kani
git-subtree-cmd
pr-merge-ff-cmd
]
++ self.checks.${system}.pre-commit-check.enabledPackages;
buildInputs = libs;
Expand Down

0 comments on commit a63649b

Please sign in to comment.