Skip to content

Commit 74fa968

Browse files
committed
Made requested changes
1 parent 5423d61 commit 74fa968

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

adabot/lib/circuitpython_library_validators.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,18 @@ def validate_actions_state(self, repo):
266266
if not (repo["owner"]["login"] == "adafruit" and
267267
repo["name"].startswith("Adafruit_CircuitPython")):
268268
return []
269-
270-
main_branch = repo["default_branch"]
271-
response = github.get("/repos/" + repo["full_name"] + "/actions/runs")
269+
270+
actions_params = {"branch": repo["default_branch"]}
271+
response = github.get(
272+
"/repos/" + repo["full_name"] + "/actions/runs",
273+
params=actions_params)
274+
272275
if not response.ok:
273-
return [error_unable_pull_repo_details]
274-
276+
return [ERROR_UNABLE_PULL_REPO_DETAILS]
277+
275278
workflow_runs = response.json()["workflow_runs"]
276-
for workflow in workflow_runs:
277-
if workflow["head_branch"] == main_branch:
278-
if workflow["conclusion"] == "failure":
279-
return [ERROR_GITHUB_FAILING_ACTIONS]
280-
break
279+
if workflow_runs and workflow_runs[0]["conclusion"] == "failure":
280+
return [ERROR_GITHUB_FAILING_ACTIONS]
281281
return []
282282

283283

0 commit comments

Comments
 (0)