From 55a9efd52a258fcc2a8b40285d8dd0b9f9ed9103 Mon Sep 17 00:00:00 2001 From: Konrad Eder <53946421+Eder-K@users.noreply.github.com> Date: Wed, 29 Jan 2020 16:03:43 +0100 Subject: [PATCH] Identify requests from TravisCI website --- push.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/push.py b/push.py index e53407f03..8f1d5e50e 100644 --- a/push.py +++ b/push.py @@ -66,13 +66,20 @@ def create_job_log(test, log, exit_status): # Decipher commit from the job message if (event_type == "api"): - job_that_triggered = commit_message.split("Triggered by:")[-1] - if job_that_triggered == "manual script call": - event_type = "manual trigger" + + # Check if api request came from triggering script + if ("Triggered by:" in commit_message): + job_that_triggered = commit_message.split("Triggered by:")[-1] + if job_that_triggered == "manual script call": + event_type = "manual trigger" + else: + *_, adapter_name, _, adapter_job_id = job_that_triggered.split('/') + triggered_commit = get_job_commit(adapter_job_id) + event_type = "commit to the {}".format(adapter_name) + + # Otherwise request was sent from TravisCI website else: - *_, adapter_name, _, adapter_job_id = job_that_triggered.split('/') - triggered_commit = get_job_commit(adapter_job_id) - event_type = "commit to the {}".format(adapter_name) + event_type = "website trigger" else: triggered_commit = get_job_commit(job_id)