Repository: denoland/deno
Pull request: ci: add AI PR generation

Should also fix the issue triager workflow which was missing the GH token.

Changed files:
filename: .github/workflows/ai_pr_generation.yml
patch: @@ -0,0 +1,85 @@
+name: AI PR Generation
+
+on:
+  issues:
+    types: [labeled]
+
+jobs:
+  generate-pr:
+    if: github.event.label.name == 'ai:generate-pr'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+      issues: write
+      id-token: write
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - uses: anthropics/claude-code-action@v1
+        with:
+          timeout-minutes: 60
+          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 }}
+
+            You have been assigned to work on fixing this issue. Your goal is to:
+
+            1. **FIRST: Check for specific implementation instructions**: Before doing anything else, fetch all comments on this issue using:
+               `gh issue view ${{ github.event.issue.number }} --comments`
+
+               Look for any comments that contain the "**AI PR instruction**" banner. These comments contain specific
+               implementation guidance from maintainers that MUST take precedence over all other context.
+
+               If you find such comments:
+               - Follow the instructions in those comments EXACTLY
+               - Use them as your primary guide for the implementation
+               - The issue description and body provide context, but the AI PR instruction comments contain
+                 the authoritative implementation approach you should follow
+
+            2. **Understand the issue thoroughly**: Read the issue description, analyze what's being reported or requested.
+
+            3. **Investigate the codebase**: Find the relevant files and code sections that need to be modified to address the issue.
+
+            4. **Implement a fix or feature**: Make the necessary code changes to resolve the issue. Ensure your changes:
+               - Are minimal and focused on the issue at hand
+               - Follow the existing code style and patterns in the repository
+               - Don't introduce new bugs or regressions
+               - Include appropriate error handling
+
+            5. **Test your changes**: If applicable, run relevant tests to verify your fix works:
+               - Run existing tests that might be affected: `cargo test` or specific test commands
+               - Verify the fix manually if possible
+               - If tests fail, debug and fix them
+
+            6. **Create a pull request**: Once your changes are ready:
+               - Create a new branch with a descriptive name (e.g., `fix-issue-${{ github.event.issue.number }}`)
+               - Commit your changes with a clear commit message
+               - Push the branch and create a PR with:
+                 - Title that references the issue: "Fix #${{ github.event.issue.number }}: [brief description]"
+                 - Description explaining what was changed and why
+                 - Reference to the original issue
+
+            7. **Comment on the issue**: After creating the PR, add a comment to issue #${{ github.event.issue.number }} with:
+               - A link to the PR you created
+               - A brief summary of the changes made
+               - Include this banner: "_This PR was autogenerated and may require review and adjustments._"
+
+            Important notes:
+            - If the issue is unclear or lacks information, add a comment requesting clarification instead of creating a PR
+            - If you determine the issue is a duplicate or already fixed, comment on the issue explaining this
+            - Focus on quality over speed - it's better to ask for clarification than to create a broken PR
+            - Make sure to use `gh pr create` for creating the pull request
+            - Use `gh issue comment` to add comments to the issue
+
+            You have access to the full repository and can use git, cargo, and gh CLI commands.
+
+          claude_args: |
+            --allowedTools "Bash(git:*),Bash(cargo test:*),Bash(cargo build:*),Bash(cargo check:*),Bash(gh pr:*),Bash(gh issue:*),Bash(grep:*),Bash(find:*)"

filename: .github/workflows/issue_triage.yml
patch: @@ -14,6 +14,7 @@ jobs:
     steps:
       - uses: anthropics/claude-code-action@v1
         with:
+          github_token: ${{ secrets.DENOBOT_PAT }}
           anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
           prompt: |
             REPO: ${{ github.repository }}