mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
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>
This commit is contained in:
parent
546bb74c0c
commit
dfd1f678b6
1 changed files with 15 additions and 6 deletions
21
.github/workflows/bug-report-analysis.yml
vendored
21
.github/workflows/bug-report-analysis.yml
vendored
|
|
@ -110,12 +110,21 @@ jobs:
|
|||
let issue;
|
||||
if (context.eventName === 'workflow_dispatch') {
|
||||
const issueNumber = parseInt(context.payload.inputs.issue_number, 10);
|
||||
const { data } = await github.rest.issues.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
issue = data;
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue