From e07c4db6be3dbe8d5afe923527dfe8528c6b526a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:57:05 -0700 Subject: [PATCH] feat: add workflow_dispatch trigger to bug-report-analysis workflow (#1670) * feat: add workflow_dispatch trigger to bug-report-analysis workflow Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/98aed224-7836-4026-aebb-e6d3fd0c7d9f Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com> * fix: add input validation and error handling for workflow_dispatch issue fetch Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/98aed224-7836-4026-aebb-e6d3fd0c7d9f Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com> --- .github/workflows/bug-report-analysis.yml | 33 +++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bug-report-analysis.yml b/.github/workflows/bug-report-analysis.yml index eabf4844..25b263fd 100644 --- a/.github/workflows/bug-report-analysis.yml +++ b/.github/workflows/bug-report-analysis.yml @@ -3,6 +3,12 @@ name: 🐞 Bug Report Analyzer on: issues: types: [opened, labeled] + workflow_dispatch: + inputs: + issue_number: + description: 'Issue number to analyze' + required: true + type: number permissions: issues: write @@ -13,8 +19,9 @@ jobs: analyze-bug-report: name: Analyze Bug Report runs-on: ubuntu-latest - # Run when a bug or triage label is present on the issue, or was just applied + # Run when a bug or triage label is present on the issue, was just applied, or triggered manually if: | + github.event_name == 'workflow_dispatch' || contains(github.event.issue.labels.*.name, 'bug') || contains(github.event.issue.labels.*.name, 'triage') || github.event.label.name == 'bug' || @@ -99,7 +106,29 @@ jobs: // ── main ───────────────────────────────────────────────────────── - const issue = context.payload.issue; + // Support manual workflow_dispatch by fetching the issue when triggered that way. + let issue; + if (context.eventName === 'workflow_dispatch') { + const issueNumber = parseInt(context.payload.inputs.issue_number, 10); + if (!Number.isInteger(issueNumber) || issueNumber <= 0) { + core.setFailed(`Invalid issue_number: "${context.payload.inputs.issue_number}". Must be a positive integer.`); + return; + } + try { + const { data } = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + }); + issue = data; + } catch (err) { + core.setFailed(`Could not fetch issue #${issueNumber}: ${err.message}`); + return; + } + } else { + issue = context.payload.issue; + } + const body = issue.body || ''; const title = issue.title || '';