Skip to content

Commit cd3ce0d

Browse files
committed
feat: add manual trigger support for fuzzer fix automation
Add workflow_dispatch trigger to allow manually running the fix automation on specific issues via: gh workflow run fuzzer-fix-automation.yml -f issue_number=5322 This is useful for: - Testing the workflow before it's merged to develop - Re-running analysis on existing issues - Triggering on issues that were created before workflow was added
1 parent b6d41df commit cd3ce0d

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

.github/workflows/fuzzer-fix-automation.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ name: Fuzzer Fix Automation
33
on:
44
issues:
55
types: [opened, labeled]
6+
workflow_dispatch:
7+
inputs:
8+
issue_number:
9+
description: 'Issue number to analyze and fix'
10+
required: true
11+
type: number
612

713
jobs:
814
attempt-fix:
915
name: "Attempt to Fix Fuzzer Crash"
1016
# Only run when:
1117
# 1. Issue is opened with 'fuzzer' label, OR
12-
# 2. 'fuzzer' label is added to existing issue
18+
# 2. 'fuzzer' label is added to existing issue, OR
19+
# 3. Manually triggered via workflow_dispatch
1320
if: |
21+
github.event_name == 'workflow_dispatch' ||
1422
(github.event.action == 'opened' && contains(github.event.issue.labels.*.name, 'fuzzer')) ||
1523
(github.event.action == 'labeled' && github.event.label.name == 'fuzzer')
1624
@@ -27,6 +35,19 @@ jobs:
2735
- name: Checkout repository
2836
uses: actions/checkout@v5
2937

38+
- name: Fetch issue details (for workflow_dispatch)
39+
if: github.event_name == 'workflow_dispatch'
40+
id: fetch_issue
41+
run: |
42+
ISSUE_DATA=$(gh issue view ${{ inputs.issue_number }} --repo ${{ github.repository }} --json number,title,body,labels)
43+
echo "issue_number=${{ inputs.issue_number }}" >> $GITHUB_OUTPUT
44+
echo "issue_title=$(echo "$ISSUE_DATA" | jq -r '.title')" >> $GITHUB_OUTPUT
45+
echo "issue_body<<EOF" >> $GITHUB_OUTPUT
46+
echo "$ISSUE_DATA" | jq -r '.body' >> $GITHUB_OUTPUT
47+
echo "EOF" >> $GITHUB_OUTPUT
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
3051
- name: Setup Rust
3152
uses: ./.github/actions/setup-rust
3253
with:
@@ -44,25 +65,32 @@ jobs:
4465
- name: Extract crash details from issue
4566
id: extract
4667
run: |
68+
# Use fetched issue body for workflow_dispatch, otherwise use event issue body
69+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
70+
ISSUE_BODY="${{ steps.fetch_issue.outputs.issue_body }}"
71+
else
72+
ISSUE_BODY="${{ github.event.issue.body }}"
73+
fi
74+
4775
# Extract target name from issue body
48-
TARGET=$(echo "${{ github.event.issue.body }}" | grep -oP '(?<=\*\*Target\*\*: `)[^`]+' || echo "file_io")
76+
TARGET=$(echo "$ISSUE_BODY" | grep -oP '(?<=\*\*Target\*\*: `)[^`]+' || echo "file_io")
4977
echo "target=$TARGET" >> $GITHUB_OUTPUT
5078
5179
# Extract crash file name
52-
CRASH_FILE=$(echo "${{ github.event.issue.body }}" | grep -oP '(?<=\*\*Crash File\*\*: `)[^`]+' || echo "")
80+
CRASH_FILE=$(echo "$ISSUE_BODY" | grep -oP '(?<=\*\*Crash File\*\*: `)[^`]+' || echo "")
5381
echo "crash_file=$CRASH_FILE" >> $GITHUB_OUTPUT
5482
5583
# Extract artifact URL
56-
ARTIFACT_URL=$(echo "${{ github.event.issue.body }}" | grep -oP 'https://[^\s]+/artifacts/[0-9]+' | head -1 || echo "")
84+
ARTIFACT_URL=$(echo "$ISSUE_BODY" | grep -oP 'https://[^\s]+/artifacts/[0-9]+' | head -1 || echo "")
5785
echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_OUTPUT
5886
5987
echo "Extracted: target=$TARGET, crash_file=$CRASH_FILE"
6088
6189
- name: Attempt to fix crash with Claude
6290
env:
63-
ISSUE_NUMBER: ${{ github.event.issue.number }}
64-
ISSUE_TITLE: ${{ github.event.issue.title }}
65-
ISSUE_BODY: ${{ github.event.issue.body }}
91+
ISSUE_NUMBER: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}
92+
ISSUE_TITLE: ${{ github.event_name == 'workflow_dispatch' && steps.fetch_issue.outputs.issue_title || github.event.issue.title }}
93+
ISSUE_BODY: ${{ github.event_name == 'workflow_dispatch' && steps.fetch_issue.outputs.issue_body || github.event.issue.body }}
6694
TARGET: ${{ steps.extract.outputs.target }}
6795
CRASH_FILE: ${{ steps.extract.outputs.crash_file }}
6896
ARTIFACT_URL: ${{ steps.extract.outputs.artifact_url }}

0 commit comments

Comments
 (0)