Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
94 lines
4.2 KiB
YAML
94 lines
4.2 KiB
YAML
name: Triage New Issues
|
|
|
|
# Runs an Oz cloud agent with the repo's "triage" skill whenever a new issue is
|
|
# opened, classifying it into exactly one implementation-readiness state and
|
|
# applying the matching pnpm `state:` label.
|
|
#
|
|
# Setup:
|
|
# - The WARP_API_KEY repository secret must hold a team-scoped Oz API key.
|
|
# - The Oz by Warp GitHub App must have access to this repository and the org
|
|
# must be enabled in Warp's Admin Panel.
|
|
# - The triage skill lives at .agents/skills/triage/ and is resolved by the
|
|
# action's `skill` input below.
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
# Avoid duplicate triage runs if the same issue fires overlapping events.
|
|
concurrency:
|
|
group: triage-issue-${{ github.event.issue.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
triage:
|
|
name: Triage issue
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
# Skip automated issues (Renovate, Dependabot, bots) — they are not user
|
|
# reports and each triage run consumes Warp credits.
|
|
if: github.event.issue.user.type != 'Bot'
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read # let the agent inspect the checked-out codebase
|
|
issues: write # let the agent apply labels and comment
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Assign the author or ask whether they are working on a fix
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
# Passed as env, never inlined into the script, so the free-form body
|
|
# cannot be interpreted as shell code.
|
|
ISSUE_BODY: ${{ github.event.issue.body }}
|
|
ISSUE_URL: ${{ github.event.issue.html_url }}
|
|
AUTHOR: ${{ github.event.issue.user.login }}
|
|
run: |
|
|
fix_state=$(.github/scripts/issue-fix-intent.sh <<<"$ISSUE_BODY")
|
|
case "$fix_state" in
|
|
checked)
|
|
# GitHub refuses some authors as assignees. Triage must still run.
|
|
gh issue edit "$ISSUE_URL" --add-assignee "$AUTHOR" ||
|
|
echo "::warning::Could not assign the issue to $AUTHOR"
|
|
;;
|
|
missing)
|
|
gh issue comment "$ISSUE_URL" --body "@$AUTHOR, are you planning to open a pull request for this? If so, reply here and a maintainer will assign the issue to you, so nobody else starts on the same fix." ||
|
|
echo "::warning::Could not ask $AUTHOR about a fix"
|
|
;;
|
|
esac
|
|
|
|
- name: Triage with Oz agent
|
|
uses: warpdotdev/oz-agent-action@8025b8045e60b8733022456300c304a2ed8a3764 # v1.0.37
|
|
id: triage
|
|
timeout-minutes: 20
|
|
env:
|
|
# Authenticates the `gh` CLI the agent uses to read/label/comment.
|
|
GH_TOKEN: ${{ github.token }}
|
|
with:
|
|
# Uses .agents/skills/triage/SKILL.md as the base prompt.
|
|
skill: triage
|
|
name: "Triage issue #${{ github.event.issue.number }}"
|
|
# Only inject GitHub-generated, non-freeform values to avoid prompt
|
|
# injection; the agent fetches title/body/comments itself via `gh`.
|
|
prompt: |
|
|
Triage the GitHub issue that was just opened in this repository.
|
|
|
|
- Repository: ${{ github.repository }}
|
|
- Issue number: #${{ github.event.issue.number }}
|
|
- Issue URL: ${{ github.event.issue.html_url }}
|
|
|
|
Follow the triage skill: use the `gh` CLI to fetch the full issue
|
|
(title, body, comments, existing labels) and related open issues,
|
|
inspect this checked-out codebase, then choose exactly one
|
|
implementation-readiness state and apply the matching pnpm `state:`
|
|
label as defined in the skill's pnpm label mapping. Post status
|
|
comments as directed by the triage skill, using only an Oz run or Oz
|
|
session URL as the follow-along link. Do not use the GitHub Actions
|
|
workflow URL as the follow-along link. After labeling, post your
|
|
triage result as a comment on the issue using
|
|
`gh issue comment #${{ github.event.issue.number }}`.
|
|
warp_api_key: ${{ secrets.WARP_API_KEY }}
|
|
profile: ${{ vars.WARP_AGENT_PROFILE || '' }}
|