From 8dc40629e9938ac3b9e73cc5ff8c97912dd3af5f Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Sat, 27 Oct 2018 23:32:14 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liorations=20script=20auto=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pr-autobot.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/pr-autobot.py b/services/pr-autobot.py index ffad1b1..350ad13 100755 --- a/services/pr-autobot.py +++ b/services/pr-autobot.py @@ -3,6 +3,7 @@ import jwt, time, urllib.request, json, datetime, argparse, sys, textwrap from github import Github from colorama import Fore, Style +from time import sleep parser = argparse.ArgumentParser(description='Create PR to update nixpkgs fork') parser.add_argument('--private-key') @@ -54,14 +55,18 @@ if latest_commit != previous_commit: ### Pull request automatique ### Avancement mise à jour - [ ] Fusionner la branche - - [ ] Mettre à jour le repo local - - [ ] Exécuter `nixos-rebuild -I nixpkgs=https://github.com/nyanloutre/nixpkgs/archive/""" + latest_commit + """.tar.gz switch` """) pr = repo.create_pull(title=branch, body=pr_message, base='nixos-18.09', head=branch) - print("Pull request numéro " + pr.id + " créée") + print("Pull request numéro " + str(pr.numero) + " créée") print("URL : " + pr.html_url) + + while pr.mergeable == None: + pr = repo.get_pull(pr.number) + sleep(1) + + pr.edit(body = pr.body + "\n- [ ] Exécuter `nixos-rebuild -I nixpkgs=https://github.com/nyanloutre/nixpkgs/archive/" + pr.merge_commit_sha + ".tar.gz switch`") print("État : " + ((Fore.GREEN + "Fusionnable") if pr.mergeable else (Fore.RED + "Conflit")) + Style.RESET_ALL) open(args['cache_dir'] + '/git-revision', 'w').write(latest_commit)