mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
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>
This commit is contained in:
parent
b9e6fa9106
commit
e07c4db6be
1 changed files with 31 additions and 2 deletions
33
.github/workflows/bug-report-analysis.yml
vendored
33
.github/workflows/bug-report-analysis.yml
vendored
|
|
@ -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 || '';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue