This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch users/damccorm/gha-metrics
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 4690514bb711fcd6227c1c5dbaa61ff84a3f9548
Author: Danny McCormick <[email protected]>
AuthorDate: Fri Sep 22 09:36:33 2023 -0400

    Add all GHA runs to 
http://metrics.beam.apache.org/d/CTYdoxP4z/ga-post-commits-status?orgId=1
    
    Also exclude cancelled runs since many runs will fall into that category
---
 .test-infra/metrics/sync/github/sync_workflows.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/.test-infra/metrics/sync/github/sync_workflows.py 
b/.test-infra/metrics/sync/github/sync_workflows.py
index a83d518af4f..0b4ddfec380 100644
--- a/.test-infra/metrics/sync/github/sync_workflows.py
+++ b/.test-infra/metrics/sync/github/sync_workflows.py
@@ -17,7 +17,7 @@ You can find the cloud function in the next link
 
https://console.cloud.google.com/functions/details/us-central1/github_actions_workflows_dashboard_sync?env=gen1&project=apache-beam-testing
 Pub sub topic : 
https://console.cloud.google.com/cloudpubsub/topic/detail/github_actions_workflows_sync?project=apache-beam-testing
 Cron Job : 
https://console.cloud.google.com/cloudscheduler/jobs/edit/us-central1/github_actions_workflows_dashboard_sync?project=apache-beam-testing
-Writing the latest 10 runs of every postcommit workflow in master branch in a 
beammetrics database
+Writing the latest 10 runs of every workflow in master branch in a beammetrics 
database
 '''
 
 import os
@@ -134,13 +134,11 @@ def fetchWorkflowData():
                 workflows.append(workflowsPage)
         for pageItem in workflows:
             for item in pageItem:
-                path =item['path']
-                isPostCommit = re.search('(.*)postcommit(.*)',path)
-                if isPostCommit:
-                    result = re.search('/(.*).yml', path)
-                    path =(result.group(1)) + ".yml"
-                    workflowObject = Workflow(item['id'],item['name'],path)
-                    WORKFLOWS_OBJECT_LIST.append(workflowObject)
+                path = item['path']
+                result = re.search('/(.*).yml', path)
+                path = (result.group(1)) + ".yml"
+                workflowObject = Workflow(item['id'],item['name'],path)
+                WORKFLOWS_OBJECT_LIST.append(workflowObject)
             url = "https://api.github.com/repos/apache/beam/actions/workflows/";
             queryOptions = { 'branch' : 'master', 'per_page' : 
GH_WORKFLOWS_NUMBER_EXECUTIONS,
                         'page' :'1', 'exclude_pull_request':True }
@@ -154,7 +152,7 @@ def fetchWorkflowData():
                 if item['status'] == 'completed':
                     workflow.runUrl.append(item['html_url'])
                     workflow.listOfRuns.append(item['conclusion'])
-                else:
+                elif item['status'] != 'cancelled':
                     workflow.listOfRuns.append(item['status'])
                     workflow.runUrl.append(item['html_url'])
             for i in range(0,GH_WORKFLOWS_NUMBER_EXECUTIONS):   
@@ -184,4 +182,4 @@ def databaseOperations(connection,fetchWorkflows):
     cursor.execute(query)
     cursor.close()
     connection.commit()
-    connection.close()
\ No newline at end of file
+    connection.close()

Reply via email to