Skip to content

Commit 86f3daa

Browse files
authored
Merge pull request #8934 from jepler/exit-with-failure-please
build-board-info.py: exit with a failing status code instead of just printing errors
2 parents 17cd6aa + 6113b2f commit 86f3daa

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
@@ -176,9 +176,7 @@ def create_pr(changes, updated, git_info, user):
176176
create_branch = {"ref": "refs/heads/" + branch_name, "sha": commit_sha}
177177
response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch)
178178
if not response.ok and response.json()["message"] != "Reference already exists":
179-
print("unable to create branch")
180-
print(response.text)
181-
return
179+
raise SystemExit(f"unable to create branch: {response.text}")
182180

183181
update_file = {
184182
"message": message,
@@ -191,9 +189,7 @@ def create_pr(changes, updated, git_info, user):
191189
"/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file
192190
)
193191
if not response.ok:
194-
print("unable to post new file")
195-
print(response.text)
196-
return
192+
raise SystemExit(f"unable to post new file: {response.text}")
197193
pr_info = {
198194
"title": pr_title,
199195
"head": user + ":" + branch_name,
@@ -203,9 +199,7 @@ def create_pr(changes, updated, git_info, user):
203199
}
204200
response = github.post("/repos/adafruit/circuitpython-org/pulls", json=pr_info)
205201
if not response.ok:
206-
print("unable to create pr")
207-
print(response.text)
208-
return
202+
raise SystemExit(f"unable to create pr: {response.text}")
209203
print(changes)
210204
print(pr_info)
211205

0 commit comments

Comments
 (0)