Skip to content

Commit 93d59c4

Browse files
authored
add comments explaining the flakiness report script (#5869)
1 parent 5013ed8 commit 93d59c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/flakiness.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ async function checkWorkflowRuns (id, page = 1) {
3535

3636
const runs = response.data.workflow_runs
3737

38+
// Either there were no runs for the period or we've reached the last page and
39+
// there are no more results.
3840
if (runs.length === 0) return
3941

4042
const promises = []
4143

4244
for (const run of runs) {
45+
// Filter out first attempts to get only reruns. The idea is that if a rerun
46+
// is successful it means any failed jobs in the previous run were flaky
47+
// since a rerun without any change made them pass.
4348
if (run.run_attempt === 1) continue
4449
if (Date.parse(run.created_at) < Date.now() - DAYS * ONE_DAY) {
4550
return Promise.all(promises)
@@ -65,6 +70,7 @@ async function checkWorkflowJobs (id, page = 1) {
6570

6671
const { jobs } = response.data
6772

73+
// We've reached the last page and there are no more results.
6874
if (jobs.length === 0) return
6975

7076
for (const job of jobs) {

0 commit comments

Comments
 (0)