Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 4 additions & 23 deletions .github/workflows/maint-coverage-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
paginateWithRetry: (githubInstance, method, params) =>
githubInstance.paginate(method, params),
};
const { paginateWithRetry, withRetry } = retryHelpers;
const { paginateWithRetry } = retryHelpers;

const runs = await paginateWithRetry(
github, github.rest.actions.listWorkflowRuns,
Expand All @@ -150,30 +150,11 @@ jobs:
new Date(b.run_started_at || b.created_at || 0) -
new Date(a.run_started_at || a.created_at || 0),
);
let candidate = null;
for (const run of runs) {
const artifacts = await withRetry(() =>
github.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: run.id,
per_page: 100,
}),
);
const hasCoverageTrend = artifacts.data.artifacts.some(
(artifact) =>
artifact.name === 'gate-coverage-trend' && !artifact.expired,
);
if (hasCoverageTrend) {
candidate = run;
break;
}
}
const candidate =
runs.find((run) => ['success', 'neutral'].includes(run.conclusion || '')) || runs[0];
Comment on lines +153 to +154

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep artifact-aware run selection for coverage guard

Selecting the latest success/neutral Gate run without checking artifacts can pick docs-only or otherwise reduced runs that never upload gate-coverage-trend, gate-coverage-trend-history, or gate-coverage. In that case the downstream artifact-cache steps are configured with fail-fast: 'true' (.github/actions/artifact-cache/action.yml + artifact_cache.js discoverCommand), so the scheduled guard job fails even though an older completed run with valid coverage artifacts exists. This regresses the previous behavior that walked runs until one with non-expired coverage artifacts was found.

Useful? React with 👍 / 👎.


if (!candidate) {
core.warning(
'Unable to locate a completed Gate workflow run with coverage artifacts.',
);
core.warning('Unable to locate a completed Gate workflow run.');
Comment on lines +153 to +157
core.setOutput('run_id', '');
return;
}
Expand Down
27 changes: 4 additions & 23 deletions templates/consumer-repo/.github/workflows/maint-coverage-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
paginateWithRetry: (githubInstance, method, params) =>
githubInstance.paginate(method, params),
};
const { paginateWithRetry, withRetry } = retryHelpers;
const { paginateWithRetry } = retryHelpers;

const runs = await paginateWithRetry(
github, github.rest.actions.listWorkflowRuns,
Expand All @@ -160,30 +160,11 @@ jobs:
new Date(b.run_started_at || b.created_at || 0) -
new Date(a.run_started_at || a.created_at || 0),
);
let candidate = null;
for (const run of runs) {
const artifacts = await withRetry(() =>
github.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: run.id,
per_page: 100,
}),
);
const hasCoverageTrend = artifacts.data.artifacts.some(
(artifact) =>
artifact.name === 'gate-coverage-trend' && !artifact.expired,
);
if (hasCoverageTrend) {
candidate = run;
break;
}
}
const candidate =
runs.find((run) => ['success', 'neutral'].includes(run.conclusion || '')) || runs[0];

if (!candidate) {
core.warning(
'Unable to locate a completed Gate workflow run with coverage artifacts.',
);
core.warning('Unable to locate a completed Gate workflow run.');
Comment on lines +163 to +167
core.setOutput('run_id', '');
return;
}
Expand Down
Loading