summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Morph2023-01-29 20:09:29 -0500
committerGravatar GitHub2023-01-29 20:09:29 -0500
commit07cefe9062caac6001434d2cf5467d81292e0934 (patch)
tree1077857e92e93541d3c47f396756a277f5ba41e1
parentMerge pull request #9705 from behunin/patch-1 (diff)
parentapply-patches-by-label: Remove unused variables and imports (diff)
downloadyuzu-07cefe9062caac6001434d2cf5467d81292e0934.tar.gz
yuzu-07cefe9062caac6001434d2cf5467d81292e0934.tar.xz
yuzu-07cefe9062caac6001434d2cf5467d81292e0934.zip
Merge pull request #9706 from Morph1984/github-tagged-merge
ci: Abort on failure to query Github's API
-rw-r--r--.ci/scripts/merge/apply-patches-by-label.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/.ci/scripts/merge/apply-patches-by-label.py b/.ci/scripts/merge/apply-patches-by-label.py
index 8ddc8ff34..17bb7dc13 100644
--- a/.ci/scripts/merge/apply-patches-by-label.py
+++ b/.ci/scripts/merge/apply-patches-by-label.py
@@ -2,15 +2,12 @@
2# SPDX-License-Identifier: GPL-2.0-or-later 2# SPDX-License-Identifier: GPL-2.0-or-later
3 3
4# Download all pull requests as patches that match a specific label 4# Download all pull requests as patches that match a specific label
5# Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to> 5# Usage: python apply-patches-by-label.py <Label to Match>
6 6
7import requests, sys, json, urllib3.request, shutil, subprocess, os, traceback 7import json, requests, subprocess, sys, traceback
8 8
9tagline = sys.argv[2] 9tagline = sys.argv[2]
10 10
11http = urllib3.PoolManager()
12dl_list = {}
13
14def check_individual(labels): 11def check_individual(labels):
15 for label in labels: 12 for label in labels:
16 if (label["name"] == sys.argv[1]): 13 if (label["name"] == sys.argv[1]):
@@ -18,8 +15,9 @@ def check_individual(labels):
18 return False 15 return False
19 16
20def do_page(page): 17def do_page(page):
21 url = 'https://api.github.com/repos/yuzu-emu/yuzu/pulls?page=%s' % page 18 url = f"https://api.github.com/repos/yuzu-emu/yuzu/pulls?page={page}"
22 response = requests.get(url) 19 response = requests.get(url)
20 response.raise_for_status()
23 if (response.ok): 21 if (response.ok):
24 j = json.loads(response.content) 22 j = json.loads(response.content)
25 if j == []: 23 if j == []:
@@ -27,13 +25,13 @@ def do_page(page):
27 for pr in j: 25 for pr in j:
28 if (check_individual(pr["labels"])): 26 if (check_individual(pr["labels"])):
29 pn = pr["number"] 27 pn = pr["number"]
30 print("Matched PR# %s" % pn) 28 print(f"Matched PR# {pn}")
31 print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f", "--no-recurse-submodules"])) 29 print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", f"pull/{pn}/head:pr-{pn}", "-f", "--no-recurse-submodules"]))
32 print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn])) 30 print(subprocess.check_output(["git", "merge", "--squash", f"pr-{pn}"]))
33 print(subprocess.check_output(["git", "commit", "-m\"Merge %s PR %s\"" % (tagline, pn)])) 31 print(subprocess.check_output(["git", "commit", f"-m\"Merge {tagline} PR {pn}\""]))
34 32
35try: 33try:
36 for i in range(1,30): 34 for i in range(1,10):
37 do_page(i) 35 do_page(i)
38except: 36except:
39 traceback.print_exc(file=sys.stdout) 37 traceback.print_exc(file=sys.stdout)