in ghactions.py [0:0]
def parse_payload(run):
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_actor = run.get("actor", {}).get("login", "github")
job_trigger = run.get("triggering_actor", {}).get("login", "github[bot]")
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)
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}"