7 def needs_to_wait(repo
):
8 workflow_name
= os
.environ
.get("GITHUB_WORKFLOW")
9 run_number
= os
.environ
.get("GITHUB_RUN_NUMBER")
10 print("Workflow Name:", workflow_name
, "Run Number:", run_number
)
11 for status
in ["in_progress", "queued"]:
12 for workflow
in repo
.get_workflow_runs(status
=status
):
13 print("Looking at ", workflow
.name
, "#", workflow
.run_number
)
14 if workflow
.name
!= workflow_name
:
16 if workflow
.run_number
< int(run_number
):
17 print("Workflow {} still {} ".format(workflow
.run_number
, status
))
22 repo_name
= os
.environ
.get("GITHUB_REPOSITORY")
23 token
= os
.environ
.get("GITHUB_TOKEN")
24 gh
= github
.Github(token
)
25 repo
= gh
.get_repo(repo_name
)
26 while needs_to_wait(repo
):