Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

ci: the ci-duration report retries a server error on its job listing (#8744)

Christopher Chedeau6b96fc3efa4d
diff --git a/.github/scripts/ci-duration-guard.test.mjs b/.github/scripts/ci-duration-guard.test.mjs
index e4a751042a..8e53f46dff 100644
--- a/.github/scripts/ci-duration-guard.test.mjs
+++ b/.github/scripts/ci-duration-guard.test.mjs
@@ -93,4 +93,20 @@ describe('PR CI duration budget', () => {
expect(script).toContain('row.minutes > 12');
expect(script).toContain('Run span');
});
+
+ it('retries a server error on its job listing', () => {
+ // The listing is one request for every job of the run with its steps,
+ // and GitHub can answer it 502 at its gateway limit. github-script
+ // retries a server error only when the step sets `retries`; the client
+ // errors it exempts stay final.
+ const step = ci.jobs['ci-duration'].steps[0];
+ expect(step.uses).toMatch(/^actions\/github-script@/);
+ expect(step.with.retries).toBeGreaterThanOrEqual(1);
+ const exempt = String(
+ step.with['retry-exempt-status-codes'] ?? '400,401,403,404,422',
+ )
+ .split(',')
+ .map(Number);
+ expect(exempt.filter(code => code >= 500)).toEqual([]);
+ });
});
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7557f09c69..6d1cc11980 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2666,6 +2666,10 @@ jobs:
- name: Report job durations
uses: actions/github-script@v9
with:
+ # The listing is one request for every job of the run with its
+ # steps, and GitHub can answer it 502 at its gateway limit: retry a
+ # server error. The action's exempt client errors stay final.
+ retries: 3
script: |
const jobs = await github.paginate(
github.rest.actions.listJobsForWorkflowRunAttempt,