Améliorations script auto PR

This commit is contained in:
nyanloutre 2018-10-27 23:32:14 +02:00
parent 813010d7f2
commit 8dc40629e9
1 changed files with 8 additions and 3 deletions

View File

@ -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)