tasks/libs/github_actions_tools.py
def follow_workflow_run(run_id):
    """
    Follow the workflow run until completion.
    """

    try:
        github_workflows = create_or_refresh_macos_build_github_workflows()
        run = github_workflows.workflow_run(run_id)
    except GithubException:
        raise Exit(code=1)

    if run is None:
        print("Workflow run not found.")
        raise Exit(code=1)

    print(color_message("Workflow run link: " + color_message(run["html_url"], "green"), "blue"))

    minutes = 0
    failures = 0
    MAX_FAILURES = 5
    while True:
        # Do not fail outright for temporary failures
        try:
            github_workflows = create_or_refresh_macos_build_github_workflows(github_workflows)
            run = github_workflows.workflow_run(run_id)
        except GithubException:
            failures += 1
            print(f"Workflow run not found, retrying in 15 seconds (failure {failures}/{MAX_FAILURES})")
            if failures == MAX_FAILURES:
                raise Exit(code=1)
            sleep(15)
            continue

        status = run["status"]
        conclusion = run["conclusion"]

        if status == "completed":
            if conclusion == "success":
                print(color_message("Workflow run succeeded", "green"))
                return
            else:
                print(color_message(f"Workflow run ended with state: {conclusion}", "red"))
                raise Exit(code=1)
        else:
            print(f"Workflow still running... ({minutes}m)")
            # For some unknown reason, in Gitlab these lines do not get flushed, leading to not being
            # able to see where's the job at in the logs. The following line forces the flush.
            sys.stdout.flush()

        minutes += 1
        sleep(60)

    Follow the workflow run until completion.
    
Follow the workflow run until completion.
Follow the workflow run until completion .
def follow_workflow_run(run_id):
    try:
        github_workflows = create_or_refresh_macos_build_github_workflows()
        run = github_workflows.workflow_run(run_id)
    except GithubException:
        raise Exit(code=1)
    if run is None:
        print("Workflow run not found.")
        raise Exit(code=1)
    print(color_message("Workflow run link: " + color_message(run["html_url"], "green"), "blue"))
    minutes = 0
    failures = 0
    MAX_FAILURES = 5
    while True:
        try:
            github_workflows = create_or_refresh_macos_build_github_workflows(github_workflows)
            run = github_workflows.workflow_run(run_id)
        except GithubException:
            failures += 1
            print(f"Workflow run not found, retrying in 15 seconds (failure {failures}/{MAX_FAILURES})")
            if failures == MAX_FAILURES:
                raise Exit(code=1)
            sleep(15)
            continue
        status = run["status"]
        conclusion = run["conclusion"]
        if status == "completed":
            if conclusion == "success":
                print(color_message("Workflow run succeeded", "green"))
                return
            else:
                print(color_message(f"Workflow run ended with state: {conclusion}", "red"))
                raise Exit(code=1)
        else:
            print(f"Workflow still running... ({minutes}m)")
            sys.stdout.flush()
        minutes += 1
        sleep(60)
def follow_workflow_run ( run_id ) : try : github_workflows = create_or_refresh_macos_build_github_workflows ( ) run = github_workflows . workflow_run ( run_id ) except GithubException : raise Exit ( code = 1 ) if run is None : print ( "Workflow run not found." ) raise Exit ( code = 1 ) print ( color_message ( "Workflow run link: " + color_message ( run [ "html_url" ] , "green" ) , "blue" ) ) minutes = 0 failures = 0 MAX_FAILURES = 5 while True : try : github_workflows = create_or_refresh_macos_build_github_workflows ( github_workflows ) run = github_workflows . workflow_run ( run_id ) except GithubException : failures += 1 print ( f"Workflow run not found, retrying in 15 seconds (failure {failures}/{MAX_FAILURES})" ) if failures == MAX_FAILURES : raise Exit ( code = 1 ) sleep ( 15 ) continue status = run [ "status" ] conclusion = run [ "conclusion" ] if status == "completed" : if conclusion == "success" : print ( color_message ( "Workflow run succeeded" , "green" ) ) return else : print ( color_message ( f"Workflow run ended with state: {conclusion}" , "red" ) ) raise Exit ( code = 1 ) else : print ( f"Workflow still running... ({minutes}m)" ) sys . stdout . flush ( ) minutes += 1 sleep ( 60 )
Follow the workflow run until completion.
Follow the workflow run until completion .
"""
    Follow the workflow run until completion.
    """ # Do not fail outright for temporary failures # For some unknown reason, in Gitlab these lines do not get flushed, leading to not being # able to see where's the job at in the logs. The following line forces the flush.
run_id