@@ -89,38 +89,59 @@ jobs:
89
89
import httpx
90
90
import sys
91
91
92
- url = "https://api.github.com/repos/${{ github.repository }}/commits/tags/${{ needs.setup.outputs.devTag }}/check-runs?per_page=100&page={page}"
92
+ check_runs_url = "https://api.github.com/repos/${{ github.repository }}/commits/tags/${{ needs.setup.outputs.devTag }}/check-runs?per_page=100&page={page}"
93
+ jobs_url="https://api.github.com/repos/supertokens/supertokens-python/actions/runs/${{ github.run_id }}/jobs"
94
+
95
+ current_jobs_response = httpx.get(jobs_url).json()
96
+ current_job_ids = [job["id"] for job in current_jobs_response["jobs"]]
97
+
93
98
page = 1
94
99
total = 0
95
100
96
101
status_map = defaultdict(int)
97
102
conclusion_map = defaultdict(int)
103
+ failures = []
98
104
99
105
while True:
100
- response = httpx.get(url.format(page=page)).json()
106
+ response = httpx.get(check_runs_url.format(page=page)).json()
107
+
108
+ if len(response["check_runs"]) == 0:
109
+ break
110
+
111
+ for run_info in response["check_runs"]:
112
+ # Release pipeline jobs also show up in check-runs
113
+ # We skip them from the checks to avoid pipeline failures
114
+ if run_info["id"] in current_job_ids:
115
+ continue
101
116
102
- if len(response["check_runs"]) == 0 :
103
- break
117
+ if run_info["conclusion"] == "failure" :
118
+ failures.append(run_info["html_url"])
104
119
105
- for run_info in response["check_runs"]:
106
- status_map[run_info["status"]] += 1
107
- conclusion_map[run_info["conclusion"]] += 1
108
- total += 1
120
+ status_map[run_info["status"]] += 1
121
+ conclusion_map[run_info["conclusion"]] += 1
122
+ total += 1
109
123
110
- page += 1
124
+ page += 1
111
125
126
+ print(f"{page=}")
112
127
print(f"{total=}")
113
- print(dict(status_map))
114
- print(dict(conclusion_map))
128
+ print("Status Map =", dict(status_map))
129
+ print("Conclusion Map =", dict(conclusion_map))
130
+ print()
115
131
132
+ # Possible values (from docs):
133
+ # [completed, action_required, cancelled, failure, neutral, skipped, stale, success,
134
+ # timed_out, in_progress, queued, requested, waiting, pending]
116
135
if status_map["completed"] < total:
117
136
print("Some checks not completed.")
118
- print(dict(status_map) )
137
+ print(failures )
119
138
sys.exit(1)
120
139
121
- if conclusion_map["success"] < total:
140
+ # Possible values (from testing):
141
+ # None, success, skipped, failure
142
+ if conclusion_map.get("failure") > 0:
122
143
print("Some checks not successful.")
123
- print(dict(conclusion_map) )
144
+ print(failures )
124
145
sys.exit(1)
125
146
126
147
EOF
0 commit comments