ci: Make PR metrics comment non-blocking (no-changelog) (#28232)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Declan Carroll 2026-04-09 08:49:32 +01:00 committed by GitHub
parent 26d578dfc8
commit b7d6b6ea17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,23 +60,30 @@ if (user && pass) {
console.log(`PR #${pr}: fetching ${metrics.join(', ')} (${baselineDays}-day baseline)`); console.log(`PR #${pr}: fetching ${metrics.join(', ')} (${baselineDays}-day baseline)`);
const res = await fetch(webhookUrl, { let res;
method: 'POST', try {
headers, res = await fetch(webhookUrl, {
body: JSON.stringify({ method: 'POST',
pr_number: pr, headers,
github_repo: repo, body: JSON.stringify({
git_sha: sha, pr_number: pr,
baseline_days: baselineDays, github_repo: repo,
metric_names: metrics, git_sha: sha,
}), baseline_days: baselineDays,
signal: AbortSignal.timeout(60_000), metric_names: metrics,
}); }),
signal: AbortSignal.timeout(60_000),
});
} catch (err) {
console.warn(`Webhook unreachable, skipping metrics comment: ${err.message}`);
process.exit(0);
}
if (!res.ok) { if (!res.ok) {
const text = await res.text().catch(() => ''); const text = await res.text().catch(() => '');
console.error(`Webhook failed: ${res.status} ${res.statusText}\n${text}`); console.warn(`Webhook failed: ${res.status} ${res.statusText}\n${text}`);
process.exit(1); console.warn('Skipping metrics comment.');
process.exit(0);
} }
const { markdown, has_data } = await res.json(); const { markdown, has_data } = await res.json();