def dispatch_action(repo_owner, event_type):
    """
    Trigger an action with a particular dispatch event_type.
    Wait until it starts, and print the URL to it.
    """
    latest_id = latest_action_run(repo_owner, "repository_dispatch")["id"]

    url = f"https://api.github.com/repos/{repo_owner}/dispatches"
    data = {"event_type": event_type}

    resp = get_session().post(url, json=data)
    resp.raise_for_status()
    print(f"Success: {resp.status_code}")
    while True:
        run = latest_action_run(repo_owner, "repository_dispatch")
        if run["id"] != latest_id:
            break
        print(".", end=" ", flush=True)
        time.sleep(0.5)
    print(run["html_url"])

    Trigger an action with a particular dispatch event_type.
    Wait until it starts, and print the URL to it.
    
ci/trigger_action.py