Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a compact per-account activity summary table to the Bot Detection workflow’s GitHub Step Summary to make triage faster without needing to open the created/updated alert issue.
Changes:
- Introduces a helper to render a markdown table summarizing account age and open/closed Issues/PRs plus comment counts.
- Enhances the “no open items” path to include the same summary table in the Step Summary.
- Adds Step Summary status lines when the workflow creates/updates the alert issue (including label-failure paths), and appends the summary table after alerting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+38
to
+41
| const openIssues = (data.issues || []).filter(i => i.state === 'open').length; | ||
| const closedIssues = (data.issues || []).filter(i => i.state === 'closed').length; | ||
| const openPRs = (data.prs || []).filter(p => p.state === 'open').length; | ||
| const closedPRs = (data.prs || []).filter(p => p.state === 'closed').length; |
There was a problem hiding this comment.
buildAccountSummaryTable scans data.issues and data.prs twice each (open + closed) via separate filter(...) calls. This is unnecessary work and can become noticeably slower if an account has many items; consider counting states in a single pass (e.g., one loop/reduce) per collection.
Suggested change
| const openIssues = (data.issues || []).filter(i => i.state === 'open').length; | |
| const closedIssues = (data.issues || []).filter(i => i.state === 'closed').length; | |
| const openPRs = (data.prs || []).filter(p => p.state === 'open').length; | |
| const closedPRs = (data.prs || []).filter(p => p.state === 'closed').length; | |
| const issues = data.issues || []; | |
| let openIssues = 0; | |
| let closedIssues = 0; | |
| for (const i of issues) { | |
| if (i.state === 'open') { | |
| openIssues++; | |
| } else if (i.state === 'closed') { | |
| closedIssues++; | |
| } | |
| } | |
| const prs = data.prs || []; | |
| let openPRs = 0; | |
| let closedPRs = 0; | |
| for (const p of prs) { | |
| if (p.state === 'open') { | |
| openPRs++; | |
| } else if (p.state === 'closed') { | |
| closedPRs++; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.