Repository: denoland/deno
Pull request: ci: add ability to trigger AI issue triage manually

Should fix permission error too.

Changed files:
filename: .github/workflows/issue_triage.yml
patch: @@ -3,25 +3,33 @@ name: AI Issue Triage
 on:
   issues:
     types: [opened]
+  workflow_dispatch:
+    inputs:
+      issue_number:
+        description: 'Issue number to triage'
+        required: true
+        type: number
 
 jobs:
   triage:
-    if: github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'OWNER'
+    if: github.event_name == 'workflow_dispatch' || (github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'OWNER')
     runs-on: ubuntu-latest
     permissions:
       issues: write
       id-token: write
     steps:
       - uses: anthropics/claude-code-action@v1
         with:
+          mode: auto
           github_token: ${{ secrets.DENOBOT_PAT }}
           anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
           prompt: |
             REPO: ${{ github.repository }}
-            ISSUE NUMBER: ${{ github.event.issue.number }}
-            TITLE: ${{ github.event.issue.title }}
-            BODY: ${{ github.event.issue.body }}
-            AUTHOR: ${{ github.event.issue.user.login }}
+            ISSUE NUMBER: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}
+
+            ${{ github.event_name == 'workflow_dispatch' && 'This workflow was manually triggered to triage an existing issue. First, fetch the issue details using: `gh issue view [ISSUE_NUMBER] --repo denoland/deno --json number,title,body,author`' || format('TITLE: {0}
+            BODY: {1}
+            AUTHOR: {2}', github.event.issue.title, github.event.issue.body, github.event.issue.user.login) }}
 
             This is a new issue from an external contributor. Please analyze it and:
 
@@ -51,14 +59,14 @@ jobs:
                - Priority/Status: needs info, good first issue (for simple, well-defined bugs), etc.
                - Other: performance/perf, benchmarks, build, breaking change, tls, design limitation, etc.
 
-            5. **Add labels** using: `gh issue edit ${{ github.event.issue.number }} --add-label "label1,label2,label3"`, make sure to add "ai:triage" label.
+            5. **Add labels** using: `gh issue edit ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }} --add-label "label1,label2,label3"`, make sure to add "ai:triage" label.
 
             6. **If the issue needs more information**, also add a comment requesting specific details needed for triage and the "needs info" label.
 
             7. **If you find a likely duplicate**, post a comment mentioning the original issue(s) and add the "duplicate" label.
 
             Be thorough but efficient. Focus on accurate categorization to help maintainers prioritize their work. Make sure that your
-            comments includes this banner at the very end: "_This response is autogenerated and may contain mistakes._"
+            comments includes this banner at the very end: "_This response was generated by AI and may contain mistakes If you didn't find it useful, please add a "thumbs down" reaction._"
 
           claude_args: |
             --allowedTools "Bash(gh issue:*),Bash(gh search:*)"