|
| 1 | +name: Oz Auto-Fixer & Reviewer |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [labeled] |
| 6 | + issue_comment: |
| 7 | + types: [created] |
| 8 | + pull_request_review_comment: |
| 9 | + types: [created] |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + issues: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + issue_label_fix: |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + if: github.event_name == 'issues' && github.event.label.name == 'warp' |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Work the labeled issue |
| 26 | + uses: warpdotdev/oz-agent-action@v1 |
| 27 | + with: |
| 28 | + warp_api_key: ${{ secrets.WARP_API_KEY }} |
| 29 | + prompt: | |
| 30 | + You are working Issue #${{ github.event.issue.number }}: "${{ github.event.issue.title }}" |
| 31 | +
|
| 32 | + Issue body: |
| 33 | + "${{ github.event.issue.body }}" |
| 34 | +
|
| 35 | + Trigger: |
| 36 | + - The issue was labeled `warp`. |
| 37 | +
|
| 38 | + Goal: |
| 39 | + - Triage the issue, make the needed code changes, and open or update a pull request when code changes are warranted. |
| 40 | + - It is fine if humans also work on this issue. Coordinate with the current repo state instead of assuming exclusive ownership. |
| 41 | +
|
| 42 | + Execution rules: |
| 43 | + 1. Inspect the repository and determine the smallest correct change that moves the issue forward. |
| 44 | + 2. If the issue needs clarification before coding, leave a concise comment with the blocking question or a short plan. |
| 45 | + 3. If you implement a fix, create a branch, commit the changes, push the branch, and use `gh pr create` to open a PR against the default branch. |
| 46 | + 4. Reference the issue number in the commit message and PR body. |
| 47 | + 5. Summarize exactly what you changed and how you verified it. |
| 48 | +
|
| 49 | + issue_comment_follow_up: |
| 50 | + runs-on: ubuntu-24.04 |
| 51 | + if: github.event_name == 'issue_comment' && !github.event.issue.pull_request |
| 52 | + steps: |
| 53 | + - name: Validate trigger comment |
| 54 | + id: trigger |
| 55 | + shell: bash |
| 56 | + env: |
| 57 | + AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }} |
| 58 | + COMMENT_BODY: ${{ github.event.comment.body }} |
| 59 | + run: | |
| 60 | + trusted=false |
| 61 | + case "$AUTHOR_ASSOCIATION" in |
| 62 | + OWNER|MEMBER|COLLABORATOR) |
| 63 | + trusted=true |
| 64 | + ;; |
| 65 | + esac |
| 66 | +
|
| 67 | + matched=false |
| 68 | + lower_comment=$(printf '%s' "$COMMENT_BODY" | tr '[:upper:]' '[:lower:]') |
| 69 | + if printf '%s\n' "$lower_comment" | grep -Eq '(^|[^[:alnum:]_])@?warp([^[:alnum:]_]|$)'; then |
| 70 | + matched=true |
| 71 | + fi |
| 72 | +
|
| 73 | + echo "trusted=$trusted" >> "$GITHUB_OUTPUT" |
| 74 | + echo "matched=$matched" >> "$GITHUB_OUTPUT" |
| 75 | +
|
| 76 | + - uses: actions/checkout@v4 |
| 77 | + if: steps.trigger.outputs.trusted == 'true' && steps.trigger.outputs.matched == 'true' |
| 78 | + with: |
| 79 | + fetch-depth: 0 |
| 80 | + |
| 81 | + - name: Address issue comment |
| 82 | + if: steps.trigger.outputs.trusted == 'true' && steps.trigger.outputs.matched == 'true' |
| 83 | + uses: warpdotdev/oz-agent-action@v1 |
| 84 | + with: |
| 85 | + warp_api_key: ${{ secrets.WARP_API_KEY }} |
| 86 | + prompt: | |
| 87 | + A trusted user invoked Warp on Issue #${{ github.event.issue.number }}. |
| 88 | +
|
| 89 | + Issue title: |
| 90 | + "${{ github.event.issue.title }}" |
| 91 | +
|
| 92 | + Issue body: |
| 93 | + "${{ github.event.issue.body }}" |
| 94 | +
|
| 95 | + Latest comment: |
| 96 | + "${{ github.event.comment.body }}" |
| 97 | +
|
| 98 | + Goal: |
| 99 | + - Address the comment directly. |
| 100 | + - If the comment requests a code change, implement it and open or update a pull request. |
| 101 | + - If the comment asks for clarification, answer in a comment with a concise, technical response. |
| 102 | +
|
| 103 | + Execution rules: |
| 104 | + 1. Treat the latest comment as the highest-priority instruction. |
| 105 | + 2. If code changes are required, create or update a branch and PR tied to this issue. |
| 106 | + 3. Reply with a short summary of what you changed or why you did not change code. |
| 107 | +
|
| 108 | + pr_comment_follow_up: |
| 109 | + runs-on: ubuntu-24.04 |
| 110 | + if: github.event_name == 'issue_comment' && github.event.issue.pull_request |
| 111 | + steps: |
| 112 | + - name: Validate trigger comment |
| 113 | + id: trigger |
| 114 | + shell: bash |
| 115 | + env: |
| 116 | + AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }} |
| 117 | + COMMENT_BODY: ${{ github.event.comment.body }} |
| 118 | + run: | |
| 119 | + trusted=false |
| 120 | + case "$AUTHOR_ASSOCIATION" in |
| 121 | + OWNER|MEMBER|COLLABORATOR) |
| 122 | + trusted=true |
| 123 | + ;; |
| 124 | + esac |
| 125 | +
|
| 126 | + matched=false |
| 127 | + lower_comment=$(printf '%s' "$COMMENT_BODY" | tr '[:upper:]' '[:lower:]') |
| 128 | + if printf '%s\n' "$lower_comment" | grep -Eq '(^|[^[:alnum:]_])@?warp([^[:alnum:]_]|$)'; then |
| 129 | + matched=true |
| 130 | + fi |
| 131 | +
|
| 132 | + echo "trusted=$trusted" >> "$GITHUB_OUTPUT" |
| 133 | + echo "matched=$matched" >> "$GITHUB_OUTPUT" |
| 134 | +
|
| 135 | + - uses: actions/checkout@v4 |
| 136 | + if: steps.trigger.outputs.trusted == 'true' && steps.trigger.outputs.matched == 'true' |
| 137 | + with: |
| 138 | + fetch-depth: 0 |
| 139 | + |
| 140 | + - name: Address PR conversation comment |
| 141 | + if: steps.trigger.outputs.trusted == 'true' && steps.trigger.outputs.matched == 'true' |
| 142 | + uses: warpdotdev/oz-agent-action@v1 |
| 143 | + with: |
| 144 | + warp_api_key: ${{ secrets.WARP_API_KEY }} |
| 145 | + prompt: | |
| 146 | + A trusted user invoked Warp on Pull Request #${{ github.event.issue.number }}. |
| 147 | +
|
| 148 | + Pull request title: |
| 149 | + "${{ github.event.issue.title }}" |
| 150 | +
|
| 151 | + Latest PR conversation comment: |
| 152 | + "${{ github.event.comment.body }}" |
| 153 | +
|
| 154 | + Goal: |
| 155 | + - Address the latest PR comment. |
| 156 | + - If the comment requests a code change, implement it on the current PR branch and push. |
| 157 | + - If the comment requests review feedback or an answer, respond directly on the PR. |
| 158 | +
|
| 159 | + Execution rules: |
| 160 | + 1. Inspect the current PR diff and repository state before changing code. |
| 161 | + 2. If you make a code change, commit it clearly and push to the current PR branch. |
| 162 | + 3. Use `gh pr comment` or `gh pr review --comment` to explain the change or answer. |
| 163 | +
|
| 164 | + pr_review_comment_follow_up: |
| 165 | + runs-on: ubuntu-24.04 |
| 166 | + if: github.event_name == 'pull_request_review_comment' |
| 167 | + steps: |
| 168 | + - name: Validate trigger comment |
| 169 | + id: trigger |
| 170 | + shell: bash |
| 171 | + env: |
| 172 | + AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }} |
| 173 | + COMMENT_BODY: ${{ github.event.comment.body }} |
| 174 | + run: | |
| 175 | + trusted=false |
| 176 | + case "$AUTHOR_ASSOCIATION" in |
| 177 | + OWNER|MEMBER|COLLABORATOR) |
| 178 | + trusted=true |
| 179 | + ;; |
| 180 | + esac |
| 181 | +
|
| 182 | + matched=false |
| 183 | + lower_comment=$(printf '%s' "$COMMENT_BODY" | tr '[:upper:]' '[:lower:]') |
| 184 | + if printf '%s\n' "$lower_comment" | grep -Eq '(^|[^[:alnum:]_])@?warp([^[:alnum:]_]|$)'; then |
| 185 | + matched=true |
| 186 | + fi |
| 187 | +
|
| 188 | + echo "trusted=$trusted" >> "$GITHUB_OUTPUT" |
| 189 | + echo "matched=$matched" >> "$GITHUB_OUTPUT" |
| 190 | +
|
| 191 | + - uses: actions/checkout@v4 |
| 192 | + if: steps.trigger.outputs.trusted == 'true' && steps.trigger.outputs.matched == 'true' |
| 193 | + with: |
| 194 | + fetch-depth: 0 |
| 195 | + |
| 196 | + - name: Address PR review comment |
| 197 | + if: steps.trigger.outputs.trusted == 'true' && steps.trigger.outputs.matched == 'true' |
| 198 | + uses: warpdotdev/oz-agent-action@v1 |
| 199 | + with: |
| 200 | + warp_api_key: ${{ secrets.WARP_API_KEY }} |
| 201 | + prompt: | |
| 202 | + A trusted user invoked Warp on a PR review comment. |
| 203 | +
|
| 204 | + Pull request number: ${{ github.event.pull_request.number }} |
| 205 | + File: ${{ github.event.comment.path }} |
| 206 | + Comment: |
| 207 | + "${{ github.event.comment.body }}" |
| 208 | +
|
| 209 | + Goal: |
| 210 | + - Address the inline review comment precisely. |
| 211 | + - If a code change is needed, implement it on the current PR branch and push. |
| 212 | + - If the right outcome is explanation instead of code, reply clearly to the review comment thread. |
| 213 | +
|
| 214 | + Execution rules: |
| 215 | + 1. Focus on the referenced file and surrounding diff first. |
| 216 | + 2. Keep the fix scoped to the review comment unless adjacent cleanup is required for correctness. |
| 217 | + 3. Leave a concise follow-up explaining the resolution. |
0 commit comments