Skip to content

Commit 6113b2f

Browse files
committed
exit with a failing status code in these cases
Closes #8848
1 parent 0c3b62f commit 6113b2f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tools/build_board_info.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ def create_pr(changes, updated, git_info, user):
160160
create_branch = {"ref": "refs/heads/" + branch_name, "sha": commit_sha}
161161
response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch)
162162
if not response.ok and response.json()["message"] != "Reference already exists":
163-
print("unable to create branch")
164-
print(response.text)
165-
return
163+
raise SystemExit(f"unable to create branch: {response.text}")
166164

167165
update_file = {
168166
"message": message,
@@ -175,9 +173,7 @@ def create_pr(changes, updated, git_info, user):
175173
"/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file
176174
)
177175
if not response.ok:
178-
print("unable to post new file")
179-
print(response.text)
180-
return
176+
raise SystemExit(f"unable to post new file: {response.text}")
181177
pr_info = {
182178
"title": pr_title,
183179
"head": user + ":" + branch_name,
@@ -187,9 +183,7 @@ def create_pr(changes, updated, git_info, user):
187183
}
188184
response = github.post("/repos/adafruit/circuitpython-org/pulls", json=pr_info)
189185
if not response.ok:
190-
print("unable to create pr")
191-
print(response.text)
192-
return
186+
raise SystemExit(f"unable to create pr: {response.text}")
193187
print(changes)
194188
print(pr_info)
195189

0 commit comments

Comments
 (0)