File tree 2 files changed +65
-5
lines changed 2 files changed +65
-5
lines changed Original file line number Diff line number Diff line change
1
+ import http .client
2
+ import json
3
+ import time
4
+ import os
5
+ import sys
6
+
7
+
8
+ REPO = "supertokens/supertokens-core"
9
+ SHA = os .environ .get ("GITHUB_SHA" )
10
+ NAME = os .environ .get ("WORKFLOW_NAME" , "Publish Dev Docker Image" )
11
+
12
+ st = time .time ()
13
+
14
+ def get_latest_actions ():
15
+ conn = http .client .HTTPSConnection ("api.github.com" )
16
+ url = f"/repos/{ REPO } /actions/runs"
17
+ headers = {"User-Agent" : "Python-http.client" }
18
+ conn .request ("GET" , url , headers = headers )
19
+ response = conn .getresponse ()
20
+
21
+ if response .status == 200 :
22
+ data = response .read ()
23
+ runs = json .loads (data )['workflow_runs' ]
24
+ found = False
25
+ for run in runs :
26
+ if run ['head_sha' ] == SHA and run ['name' ] == NAME :
27
+ found = True
28
+ break
29
+
30
+ if not found :
31
+ print ("No matching workflow run found." )
32
+ sys .exit (1 )
33
+
34
+ if run ["status" ] == "completed" :
35
+ if run ["conclusion" ] == "success" :
36
+ print ("Workflow completed successfully." )
37
+ return True
38
+ else :
39
+ print (f"Workflow failed with conclusion: { run ['conclusion' ]} " )
40
+ sys .exit (1 )
41
+ else :
42
+ print (f"Failed to fetch workflow runs: { response .status } { response .reason } " )
43
+ sys .exit (1 )
44
+
45
+ return False
46
+
47
+ time .sleep (30 ) # Wait for 30 seconds before checking
48
+
49
+
50
+ while not get_latest_actions ():
51
+ print ("Waiting for the latest actions to complete..." )
52
+ time .sleep (10 )
53
+ if time .time () - st > 600 :
54
+ print ("Timed out waiting for the latest actions." )
55
+ sys .exit (1 )
Original file line number Diff line number Diff line change @@ -28,12 +28,17 @@ jobs:
28
28
outputs :
29
29
tag : ${{ steps.set_tag.outputs.TAG }}
30
30
steps :
31
- - name : Wait for Docker build
32
- uses : lewagon/wait-on-check-action@v1.3.4
31
+ - uses : actions/setup-python@v4
33
32
with :
34
- running-workflow-name : Publish Dev Docker Image
35
- ref : ${{ github.sha }}
36
- repo-token : ${{ secrets.GITHUB_TOKEN }}
33
+ python-version : ' 3.11'
34
+ - name : Checkout
35
+ uses : actions/checkout@v4
36
+
37
+ - name : Wait for Docker build
38
+ env :
39
+ SHA : ${{ github.sha }}
40
+ run : |
41
+ python .github/helper/wait-for-docker.py
37
42
38
43
- name : set tag
39
44
id : set_tag
You can’t perform that action at this time.
0 commit comments