Skip to content

Commit

Permalink
Remove the limit for querying a baseline
Browse files Browse the repository at this point in the history
`--limit=1` seems to apply before `jq` filtering, meaning our
`WORKFLOW_NAME` ("CI") workflow may not appear in the input to the jq
query. Removing `--limit` provides a default amount of inputs that jq
can then filter from, so this works better.
  • Loading branch information
tgross35 committed Jan 16, 2025
1 parent a298d92 commit cc4eee8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ci/ci-util.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,22 +201,24 @@ def locate_baseline(flags: list[str]) -> None:
"gh",
"run",
"list",
"--limit=1",
"--status=success",
f"--branch={DEFAULT_BRANCH}",
"--json=databaseId,url,headSha,conclusion,createdAt,"
"status,workflowDatabaseId,workflowName",
f'--jq=select(.[].workflowName == "{WORKFLOW_NAME}")',
# Return the first array element matching our workflow name. NB: cannot
# just use `--limit=1`, jq filtering happens after limiting. We also
# cannot just use `--workflow` because GH gets confused from
# different file names in history.
f'--jq=[.[] | select(.workflowName == "{WORKFLOW_NAME}")][0]',
],
text=True,
)
eprint(f"latest: '{latest_job}'")
except sp.CalledProcessError as e:
eprint(f"failed to run github command: {e}")
return

try:
latest = json.loads(latest_job)[0]
latest = json.loads(latest_job)
eprint("latest job: ", json.dumps(latest, indent=4))
except json.JSONDecodeError as e:
eprint(f"failed to decode json '{latest_job}', {e}")
Expand Down

0 comments on commit cc4eee8

Please sign in to comment.