Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…t-commits-status?orgId=1 (#28615)

Also exclude cancelled runs since many runs will fall into that category
  • Loading branch information
damccorm authored Sep 22, 2023
1 parent eb36dca commit 97dea71
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .test-infra/metrics/sync/github/sync_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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
Expand Down Expand Up @@ -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 }
Expand All @@ -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):
Expand Down Expand Up @@ -184,4 +182,4 @@ def databaseOperations(connection,fetchWorkflows):
cursor.execute(query)
cursor.close()
connection.commit()
connection.close()
connection.close()

0 comments on commit 97dea71

Please sign in to comment.