scripts: do_not_merge: wait for manifest before checking
Seems like github relabel rerun is susceptible to race conditions and may not rerun the label check script if the manifest workflow runs at the same time. Delay the check to explicitly wait until the currently checked sha had a successful manifest run. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
db18e4c507
commit
42e8837085
@ -4,8 +4,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
import github
|
||||
|
||||
@ -31,6 +33,30 @@ def parse_args(argv):
|
||||
return parser.parse_args(argv)
|
||||
|
||||
|
||||
WAIT_FOR_WORKFLOWS = set({"Manifest"})
|
||||
WAIT_FOR_DELAY_S = 60
|
||||
|
||||
|
||||
def workflow_delay(repo, pr):
|
||||
print(f"PR is at {pr.head.sha}")
|
||||
|
||||
while True:
|
||||
runs = repo.get_workflow_runs(head_sha=pr.head.sha)
|
||||
|
||||
completed = set()
|
||||
for run in runs:
|
||||
print(f"{run.name}: {run.status} {run.conclusion} {run.html_url}")
|
||||
if run.status == "completed" and run.conclusion == "success":
|
||||
completed.add(run.name)
|
||||
|
||||
if WAIT_FOR_WORKFLOWS.issubset(completed):
|
||||
return
|
||||
|
||||
ts = datetime.datetime.now()
|
||||
print(f"wait: {ts} completed={completed}")
|
||||
time.sleep(WAIT_FOR_DELAY_S)
|
||||
|
||||
|
||||
def main(argv):
|
||||
args = parse_args(argv)
|
||||
|
||||
@ -42,6 +68,8 @@ def main(argv):
|
||||
repo = gh.get_repo("zephyrproject-rtos/zephyr")
|
||||
pr = repo.get_pull(args.pull_request)
|
||||
|
||||
workflow_delay(repo, pr)
|
||||
|
||||
print(f"pr: {pr.html_url}")
|
||||
|
||||
fail = False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user