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