From 414be4c06a6422b95fe266e6203c038f61d7f5ef Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Fri, 26 Apr 2019 00:04:44 +0200 Subject: [PATCH] pr-autobot: migration 18.09 -> 19.03 --- services/auto-pr.nix | 2 +- services/pr-autobot.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/auto-pr.nix b/services/auto-pr.nix index 0ac765c..228f7a9 100644 --- a/services/auto-pr.nix +++ b/services/auto-pr.nix @@ -27,7 +27,7 @@ in ignoreCollisions = true; }; in "${pkgs.writeShellScriptBin "run.sh" '' - ${env}/bin/python ${pkgs.writeScript "pr-autobot.py" "${readFile ./pr-autobot.py}"} --private-key /var/lib/auto-pr-bot/private-key.pem --app-id 19565 --installation-id 407088 --repo nyanloutre/nixpkgs --cache-dir /var/cache/auto-pr-bot + ${env}/bin/python ${pkgs.writeScript "pr-autobot.py" "${readFile ./pr-autobot.py}"} --private-key /var/lib/auto-pr-bot/private-key.pem --app-id 19565 --installation-id 407088 --repo nyanloutre/nixpkgs --cache-dir /var/cache/auto-pr-bot --version 19.03 ''}/bin/run.sh"; }; }; diff --git a/services/pr-autobot.py b/services/pr-autobot.py index a1ad4b1..c97a2c9 100755 --- a/services/pr-autobot.py +++ b/services/pr-autobot.py @@ -11,9 +11,10 @@ parser.add_argument('--app-id') parser.add_argument('--installation-id') parser.add_argument('--repo') parser.add_argument('--cache-dir') +parser.add_argument('--version') args = vars(parser.parse_args()) -channel_req = urllib.request.Request(url='https://nixos.org/channels/nixos-18.09/git-revision') +channel_req = urllib.request.Request(url='https://nixos.org/channels/nixos-' + args["version"] + '/git-revision') latest_commit = urllib.request.urlopen(channel_req).read().decode('utf-8') try: previous_commit = open(args['cache_dir'] + '/git-revision', 'r').read() @@ -57,7 +58,7 @@ if latest_commit != previous_commit: - [ ] Fusionner la branche """) - pr = repo.create_pull(title=branch, body=pr_message, base='nixos-18.09', head=branch) + pr = repo.create_pull(title=branch, body=pr_message, base='nixos-' + args["version"], head=branch) print("Pull request numéro " + str(pr.number) + " créée") print("URL : " + pr.html_url)