mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Show information for when a workflow run is not yet in the completed
state
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
866e40e12a
commit
24bd2879ff
2 changed files with 18 additions and 3 deletions
|
@ -125,7 +125,19 @@ def setup_testsuite(
|
|||
)
|
||||
|
||||
if run_id is None:
|
||||
ctx.error("Unable to find the appropriate workflow run ID")
|
||||
run_id = tools.utils.gh.discover_run_id(
|
||||
ctx,
|
||||
branch=branch,
|
||||
nightly=nightly,
|
||||
pr=pr,
|
||||
completed_status=False,
|
||||
)
|
||||
if run_id is None:
|
||||
ctx.error("Unable to find the appropriate workflow run ID")
|
||||
else:
|
||||
ctx.warn(
|
||||
f"Looks like we found run_id {run_id} but it's not yet in the completed state"
|
||||
)
|
||||
ctx.exit(1)
|
||||
|
||||
exitcode = tools.utils.gh.download_onedir_artifact(
|
||||
|
|
|
@ -308,22 +308,25 @@ def discover_run_id(
|
|||
nightly: str = None,
|
||||
pr: int = None,
|
||||
repository: str = "saltstack/salt",
|
||||
completed_status: bool = True,
|
||||
) -> int | None:
|
||||
ctx.info(f"Discovering the run_id({branch=}, {nightly=}, {pr=}, {repository=})")
|
||||
run_id: int | None = None
|
||||
with ctx.web as web:
|
||||
headers = {
|
||||
"Accept": "application/vnd.github+json",
|
||||
"X-GitHub-Api-Version": "2022-11-28",
|
||||
}
|
||||
github_token = get_github_token(ctx)
|
||||
if github_token is not None:
|
||||
headers["Authorization"] = f"Bearer {github_token}"
|
||||
web.headers.update(headers)
|
||||
|
||||
params = {
|
||||
params: dict[str, str | int] = {
|
||||
"per_page": 100,
|
||||
"status": "completed",
|
||||
}
|
||||
if completed_status is True:
|
||||
params["status"] = "completed"
|
||||
if branch is not None:
|
||||
ret = web.get(
|
||||
f"https://api.github.com/repos/{repository}/git/ref/heads/{branch}"
|
||||
|
|
Loading…
Add table
Reference in a new issue