chore: ask for debug logs on new bug issues#245
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughAdds a GitHub Actions workflow that runs on issue creation/label events for issues labeled "bug", inspects the issue body and comments for non-empty fenced code blocks in "hm2mqtt Logs" and "Hame Relay Logs", and posts a templated "needs-logs" comment (with duplicate-comment prevention) when logs are missing or empty. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant "GitHub Issues" as Issues
participant "Actions Runner\n(bug-needs-logs.yml)" as Workflow
participant "GitHub API" as API
User->>Issues: create or label issue ("bug")
Issues->>Workflow: trigger workflow
Workflow->>API: fetch issue body
Workflow->>API: fetch issue comments
Workflow->>Workflow: detect fenced code blocks for\n"hm2mqtt Logs" and "Hame Relay Logs" (regex)
alt both sections present
Workflow->>API: no further action (exit)
else missing/empty section(s)
Workflow->>API: post templated "needs-logs" comment (skip if marker found)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/bug-needs-logs.yml:
- Line 1: The YAML parse fails because the unquoted value of the name key
contains a colon; update the workflow header by quoting the name value (change
the name key's value in the top-level "name" field from Bug reports: ask for
logs to a quoted string like "Bug reports: ask for logs" or 'Bug reports: ask
for logs') so the colon is treated as part of the string and the workflow will
parse correctly.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/bug-needs-logs.yml:
- Around line 74-92: The YAML action is breaking because the raw multiline
template literal assigned to commentBody (using backticks and embedded newlines)
causes actionlint/yamllint parse errors; update the code that builds commentBody
(the variable named commentBody, which currently interpolates marker) to
construct the string without a raw template literal—e.g. build an array of lines
and use join('\n') or concatenate with '\n', preserving the marker interpolation
and the same content and redaction note, so the script block stays valid YAML.
🧹 Nitpick comments (1)
.github/workflows/bug-needs-logs.yml (1)
42-65: Consider scanning comments for logs to avoid false positives.Line 42 only inspects the issue body; if logs are posted in comments before labeling, the bot will still request logs. Since comments are already fetched, you can include their bodies in the scan.
♻️ Suggested refactor
- const body = issue.body || ''; + const body = issue.body || ''; + const combinedText = [body, ...comments.map(c => c.body || '')].join('\n'); - function sectionHasNonEmptyCodeBlock(sectionTitle) { + function sectionHasNonEmptyCodeBlock(sectionTitle, text) { const re = new RegExp( `###\\s+${sectionTitle}\\s*[\\r\\n]+([\\s\\S]*?)(?:\\n###\\s+|$)`, 'i', ); - const m = body.match(re); + const m = text.match(re); if (!m) return false; const section = m[1]; const code = section.match(/```[a-zA-Z0-9_-]*\n([\s\S]*?)```/); if (!code) return false; const content = (code[1] || '').trim(); return content.length > 0; } - const hasHm2mqttLogs = sectionHasNonEmptyCodeBlock('hm2mqtt Logs'); - const hasRelayLogs = sectionHasNonEmptyCodeBlock('Hame Relay Logs'); + const hasHm2mqttLogs = sectionHasNonEmptyCodeBlock('hm2mqtt Logs', combinedText); + const hasRelayLogs = sectionHasNonEmptyCodeBlock('Hame Relay Logs', combinedText);
Creates a GitHub Action that automatically comments on new issues labeled bug when logs are missing.
It asks for:
log_level: debug,debug: true, then restart)The workflow avoids duplicate comments via an HTML marker.
Summary by CodeRabbit