Skip to content

Commit a0e768b

Browse files
authored
Merge pull request github#6172 from tamasvajk/fix/csv-comment-again
Fix CSV framework coverage commenter workflow
2 parents 22dd53f + 513482b commit a0e768b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

misc/scripts/library-coverage/comment-pr.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ def get_previous_run_id(repo, run_id, pr_number):
121121
pr_repo = this_run["head_repository"]
122122

123123
# Get all previous runs that match branch, repo and workflow name:
124-
ids = utils.subprocess_check_output(["gh", "api", "-X", "GET", f"repos/{repo}/actions/runs", "-f", "event=pull_request", "-f", "status=success", "-f", "name=\"" + artifacts_workflow_name + "\"", "--jq",
125-
f"[.workflow_runs.[] | select(.head_branch==\"{pr_branch}\" and .head_repository.full_name==\"{pr_repo}\") | {{ created_at: .created_at, run_id: .id}}] | sort_by(.created_at) | reverse | [.[].run_id]"])
124+
output = utils.subprocess_check_output(["gh", "api", "-X", "GET", f"repos/{repo}/actions/runs", "-f", "event=pull_request", "-f", "status=success", "-f", f"branch='{pr_branch}'", "--paginate",
125+
"--jq", f'[.workflow_runs.[] | select(.head_repository.full_name=="{pr_repo}" and .name=="{artifacts_workflow_name}")] | sort_by(.id) | reverse | [.[].id]'])
126+
127+
ids = []
128+
for l in [json.loads(l) for l in output.splitlines()]:
129+
for id in l:
130+
ids.append(id)
126131

127-
ids = json.loads(ids)
128132
if ids[0] != int(run_id):
129133
raise Exception(
130134
f"Expected to find {run_id} in the list of matching runs.")

0 commit comments

Comments
 (0)