Skip to content

chore: ask for debug logs on new bug issues#245

Merged
tomquist merged 4 commits into
mainfrom
chore/bug-issues-ask-for-logs
Feb 5, 2026
Merged

chore: ask for debug logs on new bug issues#245
tomquist merged 4 commits into
mainfrom
chore/bug-issues-ask-for-logs

Conversation

@tomquist
Copy link
Copy Markdown
Owner

@tomquist tomquist commented Feb 4, 2026

Creates a GitHub Action that automatically comments on new issues labeled bug when logs are missing.

It asks for:

  • hm2mqtt DEBUG logs (HA add-on: log_level: debug, debug: true, then restart)
  • Hame Relay DEBUG logs
  • reminder to redact IDs/credentials

The workflow avoids duplicate comments via an HTML marker.

Summary by CodeRabbit

  • Chores
    • Enhanced bug-report workflow to automatically request required hm2mqtt and Hame Relay logs when a new bug issue lacks them.
    • Detects existing logs to avoid duplicate prompts and posts a clear, step-by-step comment with instructions for enabling, collecting, and redacting logs to help triage and speed up fixes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 4, 2026

Warning

Rate limit exceeded

@tomquist has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Walkthrough

Adds 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

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/bug-needs-logs.yml
New workflow triggered on issue open/label events for issues labeled "bug". Reads issue body and comments via actions/github-script, detects non-empty fenced code blocks for "hm2mqtt Logs" and "Hame Relay Logs" using regex, early-exits if logs present, and posts a templated multi-step log-request comment when missing (skips posting if marker comment already exists).

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: ask for debug logs on new bug issues' accurately reflects the main change: adding a GitHub Actions workflow that automatically requests debug logs on new bug issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/bug-issues-ask-for-logs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread .github/workflows/bug-needs-logs.yml Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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);

Comment thread .github/workflows/bug-needs-logs.yml Outdated
@tomquist tomquist merged commit bde819b into main Feb 5, 2026
15 checks passed
@tomquist tomquist deleted the chore/bug-issues-ask-for-logs branch March 29, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant