You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try and address TOCTOU issues in gemini-cli.yml (#187)
This ensures we check out the data from the event (instead of the head).
I am struggling to test this in my local branch. I keep getting failed
invocations or tool command errors.
You are a helpful AI assistant invoked via a CLI interface in a GitHub workflow. You have access to tools to interact with the repository and respond to the user.
Start by running these commands to gather the required data and context:
240
146
241
-
## User Request
242
-
243
-
The user has sent the following request:
244
-
`${{ steps.get_context.outputs.user_request }}`
147
+
1. Run: echo "${DESCRIPTION}" to get a description of the pull request or issue
148
+
2. Run: echo "${EVENT_NAME}" to learn what kind of GitHub event triggered this request
149
+
3. Run: echo "${IS_PULL_REQUEST}" to learn whether this is a Pull Request (PR) or Issue
150
+
4. Run: echo "${ISSUE_NUMBER}" to get the PR or Issue number
151
+
5. Run: echo "${REPOSITORY}" to get the github repository in <OWNER>/<REPO> format
152
+
6. Run: echo "${USER_REQUEST}" to get the user's request
245
153
246
154
## How to Respond to Issues, PR Comments, and Questions
247
155
248
156
This workflow supports three main scenarios:
249
157
250
158
1. **Creating a Fix for an Issue**
251
159
- Carefully read the user request and the related issue or PR description.
252
-
- Use available tools to gather all relevant context (e.g., `gh issue view`, `gh pr view`, `gh pr diff`, `cat`, `head`, `tail`).
160
+
- Use available tools to gather all relevant context (e.g., `gh issue view`, `gh issue comments list` `gh pr diff`, `cat`, `head`, `tail`).
253
161
- Identify the root cause of the problem before proceeding.
254
162
- **Show and maintain a plan as a checklist**:
255
163
- At the very beginning, outline the steps needed to resolve the issue or address the request and post them as a checklist comment on the issue or PR (use GitHub markdown checkboxes: `- [ ] Task`).
@@ -262,54 +170,63 @@ jobs:
262
170
- [ ] Update documentation
263
171
- [ ] Verify the fix and close the issue
264
172
```
265
-
- Use: `gh pr comment "${ISSUE_NUMBER}" --body "<plan>"` or `gh issue comment "${ISSUE_NUMBER}" --body "<plan>"` to post the initial plan.
173
+
- Use: `gh issue comment "${ISSUE_NUMBER}" --body "<plan>"` to post the initial plan.
266
174
- As you make progress, keep the checklist visible and up to date by editing the same comment (check off completed tasks with `- [x]`).
267
175
- To update the checklist:
268
-
1. Find the comment ID for the checklist (use `gh pr comment list "${ISSUE_NUMBER}"` or `gh issue comment list "${ISSUE_NUMBER}"`).
1. Find the comment ID for the checklist: `gh issue comment list "${ISSUE_NUMBER}"`
177
+
2. Edit the comment with the updated checklist: `gh issue comment --edit "<comment-id>" --body "<updated plan>"`
272
178
3. The checklist should only be maintained as a comment on the issue or PR. Do not track or update the checklist in code files.
273
179
- If the fix requires code changes, determine which files and lines are affected. If clarification is needed, note any questions for the user.
274
180
- Make the necessary code or documentation changes using the available tools (e.g., `write_file`). Ensure all changes follow project conventions and best practices. Reference all shell variables as `"${VAR}"` (with quotes and braces) to prevent errors.
275
181
- Run any relevant tests or checks to verify the fix works as intended. If possible, provide evidence (test output, screenshots, etc.) that the issue is resolved.
276
182
- **Branching and Committing**:
277
183
- **NEVER commit directly to the `main` branch.**
278
-
- If you are working on a **pull request** (`IS_PR` is `true`), the correct branch is already checked out. Simply commit and push to it.
184
+
- If you are working on a **pull request** (`IS_PULL_REQUEST` is `true`), the correct branch is already checked out. Simply commit and push to it.
279
185
- `git add .`
280
186
- `git commit -m "feat: <describe the change>"`
281
187
- `git push`
282
-
- If you are working on an **issue** (`IS_PR` is `false`), create a new branch for your changes. A good branch name would be `issue/${ISSUE_NUMBER}/<short-description>`.
283
-
- `git checkout -b issue/${ISSUE_NUMBER}/my-fix`
188
+
- If you are working on an **issue** (`IS_PULL_REQUEST` is `false`), create a new branch for your changes. The branch name should be `gemini/fix-${ISSUE_NUMBER}`.
189
+
- `git checkout -b "gemini/fix-${ISSUE_NUMBER}"`
284
190
- `git add .`
285
191
- `git commit -m "feat: <describe the fix>"`
286
-
- `git push origin issue/${ISSUE_NUMBER}/my-fix`
287
-
- After pushing, you can create a pull request: `gh pr create --title "Fixes #${ISSUE_NUMBER}: <short title>" --body "This PR addresses issue #${ISSUE_NUMBER}."`
288
-
- Summarize what was changed and why in a markdown file: `write_file("response.md", "<your response here>")`
289
-
- Post the response as a comment:
290
-
- For PRs: `gh pr comment "${ISSUE_NUMBER}" --body-file response.md`
291
-
- For Issues: `gh issue comment "${ISSUE_NUMBER}" --body-file response.md`
- Summarize what was changed and why in `response.md` in markdown format and post it as a comment: `gh issue comment "${ISSUE_NUMBER}" --body-file "response.md"`
292
195
293
196
2. **Addressing Comments on a Pull Request**
294
-
- Read the specific comment and the context of the PR.
295
-
- Use tools like `gh pr view`, `gh pr diff`, and `cat` to understand the code and discussion.
296
-
- If the comment requests a change or clarification, follow the same process as for fixing an issue: create a checklist plan, implement, test, and commit any required changes, updating the checklist as you go.
197
+
- Read the specific description and context.
198
+
- Use tools like `gh pr diff` and `cat` to understand the code and discussion.
199
+
- If the description requests a change or clarification, follow the same process as for fixing an issue: create a checklist plan, implement, test, and commit any required changes, updating the checklist as you go.
297
200
- **Committing Changes**: The correct PR branch is already checked out. Simply add, commit, and push your changes.
298
201
- `git add .`
299
202
- `git commit -m "fix: address review comments"`
300
203
- `git push`
301
-
- If the comment is a question, answer it directly and clearly, referencing code or documentation as needed.
302
-
- Document your response in `response.md` and post it as a PR comment: `gh pr comment "${ISSUE_NUMBER}" --body-file response.md`
204
+
- If the description is a question, answer it directly and clearly, referencing code or documentation as needed.
205
+
- Document your response in `response.md` in markdown format and post it as a comment: `gh issue comment "${ISSUE_NUMBER}" --body-file "response.md"`
303
206
304
207
3. **Answering Any Question on an Issue**
305
-
- Read the question and the full issue context using `gh issue view` and related tools.
208
+
- Read the description and the full context.
306
209
- Research or analyze the codebase as needed to provide an accurate answer.
307
210
- If the question requires code or documentation changes, follow the fix process above, including creating and updating a checklist plan and **creating a new branch for your changes as described in section 1.**
308
-
- Write a clear, concise answer in `response.md` and post it as an issue comment: `gh issue comment "${ISSUE_NUMBER}" --body-file response.md`
211
+
- Write a clear, concise answer in `response.md` in markdown format and post it as a comment: `gh issue comment "${ISSUE_NUMBER}" --body-file "response.md"`
309
212
310
213
## Guidelines
311
214
312
215
- **Be concise and actionable.** Focus on solving the user's problem efficiently.
313
216
- **Always commit and push your changes if you modify code or documentation.**
314
217
- **If you are unsure about the fix or answer, explain your reasoning and ask clarifying questions.**
315
218
- **Follow project conventions and best practices.**
🤖 I'm sorry @${{ github.actor }}, but I was unable to process your request. Please [see the logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
0 commit comments