ci: Add AI triage automation for GitHub issues#1576
ci: Add AI triage automation for GitHub issues#1576devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: alexandre@airbyte.io <alexandre@airbyte.io>
Co-Authored-By: alexandre@airbyte.io <alexandre@airbyte.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| if: ${{ !github.event.issue.pull_request }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Authenticate as GitHub App | ||
| uses: actions/create-github-app-token@v2 | ||
| id: get-app-token | ||
| with: | ||
| owner: "airbytehq" | ||
| repositories: "airbyte-agent-connectors" | ||
| app-id: ${{ secrets.OCTAVIA_BOT_APP_ID }} | ||
| private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }} | ||
|
|
||
| - name: Slash Command Dispatch | ||
| id: scd | ||
| uses: peter-evans/slash-command-dispatch@v3 | ||
| with: | ||
| token: ${{ steps.get-app-token.outputs.token }} | ||
| commands: | | ||
| ai-triage | ||
| ai-fix | ||
| static-args: | | ||
| issue=${{ github.event.issue.number }} | ||
| comment-id=${{ github.event.comment.id }} | ||
|
|
||
| - name: Edit comment with error message | ||
| if: steps.scd.outputs.error-message | ||
| uses: peter-evans/create-or-update-comment@v1 | ||
| with: | ||
| comment-id: ${{ github.event.comment.id }} | ||
| body: | | ||
| > Error: ${{ steps.scd.outputs.error-message }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
In general, the fix is to add an explicit permissions block either at the workflow root (applies to all jobs) or inside the slashCommandDispatch job, granting only the scopes needed. This documents the workflow’s requirements and prevents it from inheriting overly broad defaults such as contents: write.
For this particular workflow, it needs to: (1) read issue and comment data (already available via the event payload and via the GitHub App token), and (2) create or update comments on issues via peter-evans/create-or-update-comment@v1. That action, when not configured with a custom token, uses GITHUB_TOKEN and requires issues: write (or pull-requests: write for PR comments). Since the workflow is explicitly limited to non-PR issues (if: ${{ !github.event.issue.pull_request }}), we can safely grant issues: write and set contents: read minimally. The best fix is to add a job-level permissions block under slashCommandDispatch: with contents: read and issues: write. No imports or other code changes are necessary.
Concretely, in .github/workflows/issue-slash-commands.yml, under slashCommandDispatch: and before runs-on: ubuntu-latest, insert:
permissions:
contents: read
issues: writeThis keeps functionality intact while limiting GITHUB_TOKEN to only what’s needed.
| @@ -8,6 +8,9 @@ | ||
| slashCommandDispatch: | ||
| # Only allow slash commands on issues (not PRs) | ||
| if: ${{ !github.event.issue.pull_request }} | ||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code |
Summary
Adds automated AI triage for GitHub issues in this repository. When a new issue is opened, Devin AI will automatically analyze it and post a triage report with root cause analysis and recommended next steps.
This PR adds two workflows:
/ai-triageslash command (manual). Invokes Devin with the!agent_connector_triageplaybook./ai-triageand/ai-fixslash commands from issue comments.Companion PR: The playbook referenced by this workflow is being added in airbytehq/oncall#11169.
Review & Testing Checklist for Human
OCTAVIA_BOT_APP_ID,OCTAVIA_BOT_PRIVATE_KEY, andDEVIN_AI_API_KEYsecrets in the repo settingsai-triagelabel: The workflow adds this label to issues, so it should exist in the repo!agent_connector_triagemust exist before this workflow can succeed/ai-fixis registered but has no workflow: The slash command dispatcher registers/ai-fixbut there's no corresponding workflow yet - this is intentional for future expansionTest plan: After merging both PRs and configuring secrets, create a test issue in this repo and verify that Devin automatically posts a triage comment.
Notes
Requested by: Alexandre Burgoni (@alexandrebrg)
Link to Devin run: https://app.devin.ai/sessions/6ee0a9d7dbb142b495efa3b2f300f24a