Skip to content

Commit 7258a16

Browse files
Mossakaclaude
andauthored
perf: run benchmarks daily and deduplicate regression issues (#1871)
* perf: run benchmarks daily and deduplicate regression issues - Change cron schedule from weekly (Mondays) to daily at 06:00 UTC - When a regression is detected, check for an existing open issue with performance+needs-investigation labels before creating a new one. If one exists, comment on it with updated data instead of duplicating. Closes #1865 Closes #1868 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: filter out PRs from dedup query and trim update comments Address Copilot review feedback: - Filter out pull requests from issues.listForRepo results since the API returns both issues and PRs; an open PR with matching labels could be mistakenly selected instead of a regression issue. - Reduce update comment size to a short summary (date, run link, commit, regression list) with a link to full artifacts, avoiding potential GitHub comment size limits on daily runs. - Bump per_page from 1 to 5 to account for PRs being filtered out. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 46dbac3 commit 7258a16

1 file changed

Lines changed: 34 additions & 8 deletions

File tree

.github/workflows/performance-monitor.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Performance Monitor
22

33
on:
44
schedule:
5-
# Run weekly on Mondays at 06:00 UTC
6-
- cron: "0 6 * * 1"
5+
# Run daily at 06:00 UTC
6+
- cron: "0 6 * * *"
77
workflow_dispatch:
88
inputs:
99
iterations:
@@ -165,14 +165,40 @@ jobs:
165165
].join('\n');
166166
167167
try {
168-
const issue = await github.rest.issues.create({
168+
// Check for existing open regression issue to avoid duplicates on daily runs
169+
const existing = await github.rest.issues.listForRepo({
169170
owner: context.repo.owner,
170171
repo: context.repo.repo,
171-
title: `Performance regression detected (${new Date().toISOString().split('T')[0]})`,
172-
body,
173-
labels: ['performance', 'needs-investigation'],
172+
labels: 'performance,needs-investigation',
173+
state: 'open',
174+
per_page: 5,
174175
});
175-
core.info(`Created regression issue: ${issue.data.html_url}`);
176+
177+
// Filter out PRs (listForRepo returns both issues and PRs)
178+
const existingIssues = existing.data.filter(item => !item.pull_request);
179+
180+
if (existingIssues.length > 0) {
181+
// Comment on existing issue with a short summary (link to run for full details)
182+
const issueNumber = existingIssues[0].number;
183+
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
184+
const regressionList = report.regressions.map(r => `- ${r}`).join('\n');
185+
await github.rest.issues.createComment({
186+
owner: context.repo.owner,
187+
repo: context.repo.repo,
188+
issue_number: issueNumber,
189+
body: `## Updated Regression Data (${new Date().toISOString().split('T')[0]})\n\n**Run:** [${context.runId}](${runUrl})\n**Commit:** ${report.commitSha}\n\n### Regressions\n${regressionList}\n\nSee the [workflow run](${runUrl}) for full results and artifacts.`,
190+
});
191+
core.info(`Updated existing regression issue #${issueNumber}`);
192+
} else {
193+
const issue = await github.rest.issues.create({
194+
owner: context.repo.owner,
195+
repo: context.repo.repo,
196+
title: `Performance regression detected (${new Date().toISOString().split('T')[0]})`,
197+
body,
198+
labels: ['performance', 'needs-investigation'],
199+
});
200+
core.info(`Created regression issue: ${issue.data.html_url}`);
201+
}
176202
} catch (error) {
177-
core.setFailed(`Failed to create regression issue: ${error.message}`);
203+
core.setFailed(`Failed to create/update regression issue: ${error.message}`);
178204
}

0 commit comments

Comments
 (0)