def parse_payload()

in ghactions.py [0:0]


def parse_payload(run):
    # Many of the variables below may appear to be unused, but they are passed to the templates via locals()
    job_status = run.get("conclusion", "unknown")
    job_name = run.get("name", "???")
    job_url = run.get("html_url", "")
    job_id = run.get("workflow_id", "")
    job_repo = run.get("repository", {}).get("name", "infrastructure-unknown")
    job_branch = run.get("head_branch", "???")
    job_actor = run.get("actor", {}).get("login", "github")
    job_trigger = run.get("triggering_actor", {}).get("login", "github[bot]")
    build_id = run.get("id", "")
    trigger_hash = run.get("head_commit", {}).get("id")
    trigger_log = run.get("head_commit", {}).get("message")
    trigger_author = run.get("head_commit", {}).get("author", {}).get("name", "??")
    trigger_email = run.get("head_commit", {}).get("author", {}).get("email", "??")
    recipient = get_recipient(job_repo)
    # Log job api url for usage stats later on
    job_api_url = run.get("jobs_url", "")
    if job_api_url and build_id:
        # Post to pubsub
        try:
            blob = {
                "build_id": build_id,
                "workflow": job_id,
                "repository": job_repo,
                "actor": job_actor,
                "jobs_url": job_api_url,
                "status": job_status,
            }
            # post to /github/$repo.git/actions/$workflow-id
            requests.post(f"https://pubsub.apache.org:2070/github/{job_repo}.git/actions/{job_id}", json=blob)
        except requests.exceptions.RequestException:  # Ignore post failures
            pass

    if not recipient:  # No address configured, skip!
        return f"[skipped] {job_repo} {job_id} {job_status}"
    if job_id not in jobs:
        jobs[job_id] = job_status
    if job_status == JOB_STATUS_FAILURE:  # Always notify on failure
        subject, text = JOB_FAILED.split("--", 1)
        subject = subject.format(**locals()).strip()
        text = text.format(**locals()).strip()
        asfpy.messaging.mail(
            sender="GitBox <git@apache.org>", recipient=recipient, subject=subject, message=text
        )
        jobs[job_id] = JOB_STATUS_FAILURE
    elif jobs[job_id] != job_status and job_status == JOB_STATUS_SUCCESS:  # Status change, notify!
        subject, text = JOB_SUCCEEDED.split("--", 1)
        subject = subject.format(**locals()).strip()
        text = text.format(**locals()).strip()
        asfpy.messaging.mail(
            sender="GitBox <git@apache.org>", recipient=recipient, subject=subject, message=text
        )
        jobs[job_id] = JOB_STATUS_SUCCESS
    return f"{job_repo} {job_id} {job_status}"