diff options
Diffstat (limited to '.ci/scripts/merge/apply-patches-by-label.py')
| -rw-r--r-- | .ci/scripts/merge/apply-patches-by-label.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/.ci/scripts/merge/apply-patches-by-label.py b/.ci/scripts/merge/apply-patches-by-label.py index b346001a5..43ed74d7f 100644 --- a/.ci/scripts/merge/apply-patches-by-label.py +++ b/.ci/scripts/merge/apply-patches-by-label.py | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | # Download all pull requests as patches that match a specific label | 1 | # Download all pull requests as patches that match a specific label |
| 2 | # Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to> | 2 | # Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to> |
| 3 | 3 | ||
| 4 | import requests, sys, json, urllib3.request, shutil, subprocess | 4 | import requests, sys, json, urllib3.request, shutil, subprocess, os |
| 5 | |||
| 6 | tagline = sys.argv[2] | ||
| 5 | 7 | ||
| 6 | http = urllib3.PoolManager() | 8 | http = urllib3.PoolManager() |
| 7 | dl_list = {} | 9 | dl_list = {} |
| @@ -12,17 +14,23 @@ def check_individual(labels): | |||
| 12 | return True | 14 | return True |
| 13 | return False | 15 | return False |
| 14 | 16 | ||
| 15 | try: | 17 | def do_page(page): |
| 16 | url = 'https://api.github.com/repos/yuzu-emu/yuzu/pulls' | 18 | url = 'https://api.github.com/repos/yuzu-emu/yuzu/pulls?page=%s' % page |
| 17 | response = requests.get(url) | 19 | response = requests.get(url) |
| 18 | if (response.ok): | 20 | if (response.ok): |
| 19 | j = json.loads(response.content) | 21 | j = json.loads(response.content) |
| 22 | if j == []: | ||
| 23 | return | ||
| 20 | for pr in j: | 24 | for pr in j: |
| 21 | if (check_individual(pr["labels"])): | 25 | if (check_individual(pr["labels"])): |
| 22 | pn = pr["number"] | 26 | pn = pr["number"] |
| 23 | print("Matched PR# %s" % pn) | 27 | print("Matched PR# %s" % pn) |
| 24 | print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f"])) | 28 | print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f"])) |
| 25 | print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn])) | 29 | print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn])) |
| 26 | print(subprocess.check_output(["git", "commit", "-m\"Merge PR %s\"" % pn])) | 30 | print(subprocess.check_output(["git", "commit", "-m\"Merge %s PR %s\"" % (tagline, pn)])) |
| 31 | |||
| 32 | try: | ||
| 33 | for i in range(1,30): | ||
| 34 | do_page(i) | ||
| 27 | except: | 35 | except: |
| 28 | sys.exit(-1) | 36 | sys.exit(-1) |