mirror of
https://github.com/flutter/samples.git
synced 2026-06-25 15:49:43 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 6.0.3. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/releases">actions/checkout's releases</a>.</em></p> <blockquote> <h2>v6.0.3</h2> <h2>What's Changed</h2> <ul> <li>Update changelog by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2357">actions/checkout#2357</a></li> <li>fix: expand merge commit SHA regex and add SHA-256 test cases by <a href="https://github.com/yaananth"><code>@yaananth</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2414">actions/checkout#2414</a></li> <li>Fix checkout init for SHA-256 repositories by <a href="https://github.com/yaananth"><code>@yaananth</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2439">actions/checkout#2439</a></li> <li>Update changelog for v6.0.3 by <a href="https://github.com/yaananth"><code>@yaananth</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2446">actions/checkout#2446</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/yaananth"><code>@yaananth</code></a> made their first contribution in <a href="https://redirect.github.com/actions/checkout/pull/2414">actions/checkout#2414</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/checkout/compare/v6...v6.0.3">https://github.com/actions/checkout/compare/v6...v6.0.3</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/blob/main/CHANGELOG.md">actions/checkout's changelog</a>.</em></p> <blockquote> <h1>Changelog</h1> <h2>v7.0.0</h2> <ul> <li>Block checking out fork PR for pull_request_target and workflow_run by <a href="https://github.com/aiqiaoy"><code>@aiqiaoy</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2454">actions/checkout#2454</a></li> <li>Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 in the minor-actions-dependencies group across 1 directory by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/checkout/pull/2458">actions/checkout#2458</a></li> <li>Bump flatted from 3.3.1 to 3.4.2 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/checkout/pull/2460">actions/checkout#2460</a></li> <li>Bump js-yaml from 4.1.0 to 4.2.0 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/checkout/pull/2461">actions/checkout#2461</a></li> <li>Bump <code>@actions/core</code> and <code>@actions/tool-cache</code> and Remove uuid by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/checkout/pull/2459">actions/checkout#2459</a></li> <li>upgrade module to esm and update dependencies by <a href="https://github.com/aiqiaoy"><code>@aiqiaoy</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2463">actions/checkout#2463</a></li> <li>Bump the minor-npm-dependencies group across 1 directory with 3 updates by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/checkout/pull/2462">actions/checkout#2462</a></li> </ul> <h2>v6.0.3</h2> <ul> <li>Fix checkout init for SHA-256 repositories by <a href="https://github.com/yaananth"><code>@yaananth</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2439">actions/checkout#2439</a></li> <li>fix: expand merge commit SHA regex and add SHA-256 test cases by <a href="https://github.com/yaananth"><code>@yaananth</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2414">actions/checkout#2414</a></li> </ul> <h2>v6.0.2</h2> <ul> <li>Fix tag handling: preserve annotations and explicit fetch-tags by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2356">actions/checkout#2356</a></li> </ul> <h2>v6.0.1</h2> <ul> <li>Add worktree support for persist-credentials includeIf by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2327">actions/checkout#2327</a></li> </ul> <h2>v6.0.0</h2> <ul> <li>Persist creds to a separate file by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2286">actions/checkout#2286</a></li> <li>Update README to include Node.js 24 support details and requirements by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2248">actions/checkout#2248</a></li> </ul> <h2>v5.0.1</h2> <ul> <li>Port v6 cleanup to v5 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2301">actions/checkout#2301</a></li> </ul> <h2>v5.0.0</h2> <ul> <li>Update actions checkout to use node 24 by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2226">actions/checkout#2226</a></li> </ul> <h2>v4.3.1</h2> <ul> <li>Port v6 cleanup to v4 by <a href="https://github.com/ericsciple"><code>@ericsciple</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2305">actions/checkout#2305</a></li> </ul> <h2>v4.3.0</h2> <ul> <li>docs: update README.md by <a href="https://github.com/motss"><code>@motss</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1971">actions/checkout#1971</a></li> <li>Add internal repos for checking out multiple repositories by <a href="https://github.com/mouismail"><code>@mouismail</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1977">actions/checkout#1977</a></li> <li>Documentation update - add recommended permissions to Readme by <a href="https://github.com/benwells"><code>@benwells</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2043">actions/checkout#2043</a></li> <li>Adjust positioning of user email note and permissions heading by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2044">actions/checkout#2044</a></li> <li>Update README.md by <a href="https://github.com/nebuk89"><code>@nebuk89</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2194">actions/checkout#2194</a></li> <li>Update CODEOWNERS for actions by <a href="https://github.com/TingluoHuang"><code>@TingluoHuang</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2224">actions/checkout#2224</a></li> <li>Update package dependencies by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/2236">actions/checkout#2236</a></li> </ul> <h2>v4.2.2</h2> <ul> <li><code>url-helper.ts</code> now leverages well-known environment variables by <a href="https://github.com/jww3"><code>@jww3</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1941">actions/checkout#1941</a></li> <li>Expand unit test coverage for <code>isGhes</code> by <a href="https://github.com/jww3"><code>@jww3</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1946">actions/checkout#1946</a></li> </ul> <h2>v4.2.1</h2> <ul> <li>Check out other refs/* by commit if provided, fall back to ref by <a href="https://github.com/orhantoy"><code>@orhantoy</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1924">actions/checkout#1924</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="df4cb1c069"><code>df4cb1c</code></a> Update changelog for v6.0.3 (<a href="https://redirect.github.com/actions/checkout/issues/2446">#2446</a>)</li> <li><a href="1cce3390c2"><code>1cce339</code></a> Fix checkout init for SHA-256 repositories (<a href="https://redirect.github.com/actions/checkout/issues/2439">#2439</a>)</li> <li><a href="900f2210b1"><code>900f221</code></a> fix: expand merge commit SHA regex and add SHA-256 test cases (<a href="https://redirect.github.com/actions/checkout/issues/2414">#2414</a>)</li> <li><a href="0c366fd6a8"><code>0c366fd</code></a> Update changelog (<a href="https://redirect.github.com/actions/checkout/issues/2357">#2357</a>)</li> <li>See full diff in <a href="de0fac2e45...df4cb1c069">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
332 lines
16 KiB
YAML
332 lines
16 KiB
YAML
name: '💬 Gemini CLI'
|
|
|
|
on:
|
|
pull_request_review_comment:
|
|
types:
|
|
- 'created'
|
|
pull_request_review:
|
|
types:
|
|
- 'submitted'
|
|
issue_comment:
|
|
types:
|
|
- 'created'
|
|
|
|
concurrency:
|
|
group: '${{ github.workflow }}-${{ github.event.issue.number }}'
|
|
cancel-in-progress: |-
|
|
${{ github.event.sender.type == 'User' && ( github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER' || github.event.issue.author_association == 'COLLABORATOR') }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: 'bash'
|
|
|
|
permissions:
|
|
contents: 'write'
|
|
id-token: 'write'
|
|
pull-requests: 'write'
|
|
issues: 'write'
|
|
|
|
jobs:
|
|
gemini-cli:
|
|
# This condition is complex to ensure we only run when explicitly invoked.
|
|
if: |-
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(
|
|
github.event_name == 'issues' && github.event.action == 'opened' &&
|
|
contains(github.event.issue.body, '@gemini-cli') &&
|
|
!contains(github.event.issue.body, '/review') &&
|
|
!contains(github.event.issue.body, '/triage') &&
|
|
(
|
|
github.event.sender.type == 'User' && (
|
|
github.event.issue.author_association == 'OWNER' ||
|
|
github.event.issue.author_association == 'MEMBER' ||
|
|
github.event.issue.author_association == 'COLLABORATOR'
|
|
)
|
|
)
|
|
) ||
|
|
(
|
|
github.event_name == 'issue_comment' &&
|
|
contains(github.event.comment.body, '@gemini-cli') &&
|
|
!contains(github.event.comment.body, '/review') &&
|
|
!contains(github.event.comment.body, '/triage') &&
|
|
(
|
|
github.event.sender.type == 'User' && (
|
|
github.event.comment.author_association == 'OWNER' ||
|
|
github.event.comment.author_association == 'MEMBER' ||
|
|
github.event.comment.author_association == 'COLLABORATOR'
|
|
)
|
|
)
|
|
) ||
|
|
(
|
|
github.event_name == 'pull_request_review' &&
|
|
contains(github.event.review.body, '@gemini-cli') &&
|
|
!contains(github.event.review.body, '/review') &&
|
|
!contains(github.event.review.body, '/triage') &&
|
|
(
|
|
github.event.sender.type == 'User' && (
|
|
github.event.review.author_association == 'OWNER' ||
|
|
github.event.review.author_association == 'MEMBER' ||
|
|
github.event.review.author_association == 'COLLABORATOR'
|
|
)
|
|
)
|
|
) ||
|
|
(
|
|
github.event_name == 'pull_request_review_comment' &&
|
|
contains(github.event.comment.body, '@gemini-cli') &&
|
|
!contains(github.event.comment.body, '/review') &&
|
|
!contains(github.event.comment.body, '/triage') &&
|
|
(
|
|
github.event.sender.type == 'User' && (
|
|
github.event.comment.author_association == 'OWNER' ||
|
|
github.event.comment.author_association == 'MEMBER' ||
|
|
github.event.comment.author_association == 'COLLABORATOR'
|
|
)
|
|
)
|
|
)
|
|
timeout-minutes: 10
|
|
runs-on: 'ubuntu-latest'
|
|
|
|
steps:
|
|
- name: 'Generate GitHub App Token'
|
|
id: 'generate_token'
|
|
if: |-
|
|
${{ vars.APP_ID }}
|
|
uses: 'actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1' # ratchet:actions/create-github-app-token@v2
|
|
with:
|
|
app-id: '${{ vars.APP_ID }}'
|
|
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
|
|
|
|
- name: 'Get context from event'
|
|
id: 'get_context'
|
|
env:
|
|
EVENT_NAME: '${{ github.event_name }}'
|
|
EVENT_PAYLOAD: '${{ toJSON(github.event) }}'
|
|
run: |-
|
|
set -euo pipefail
|
|
|
|
USER_REQUEST=""
|
|
ISSUE_NUMBER=""
|
|
IS_PR="false"
|
|
|
|
if [[ "${EVENT_NAME}" == "issues" ]]; then
|
|
USER_REQUEST=$(echo "${EVENT_PAYLOAD}" | jq -r .issue.body)
|
|
ISSUE_NUMBER=$(echo "${EVENT_PAYLOAD}" | jq -r .issue.number)
|
|
elif [[ "${EVENT_NAME}" == "issue_comment" ]]; then
|
|
USER_REQUEST=$(echo "${EVENT_PAYLOAD}" | jq -r .comment.body)
|
|
ISSUE_NUMBER=$(echo "${EVENT_PAYLOAD}" | jq -r .issue.number)
|
|
if [[ $(echo "${EVENT_PAYLOAD}" | jq -r .issue.pull_request) != "null" ]]; then
|
|
IS_PR="true"
|
|
fi
|
|
elif [[ "${EVENT_NAME}" == "pull_request_review" ]]; then
|
|
USER_REQUEST=$(echo "${EVENT_PAYLOAD}" | jq -r .review.body)
|
|
ISSUE_NUMBER=$(echo "${EVENT_PAYLOAD}" | jq -r .pull_request.number)
|
|
IS_PR="true"
|
|
elif [[ "${EVENT_NAME}" == "pull_request_review_comment" ]]; then
|
|
USER_REQUEST=$(echo "${EVENT_PAYLOAD}" | jq -r .comment.body)
|
|
ISSUE_NUMBER=$(echo "${EVENT_PAYLOAD}" | jq -r .pull_request.number)
|
|
IS_PR="true"
|
|
fi
|
|
|
|
# Clean up user request
|
|
USER_REQUEST=$(echo "${USER_REQUEST}" | sed 's/.*@gemini-cli//' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
|
|
{
|
|
echo "user_request=${USER_REQUEST}"
|
|
echo "issue_number=${ISSUE_NUMBER}"
|
|
echo "is_pr=${IS_PR}"
|
|
} >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: 'Set up git user for commits'
|
|
run: |-
|
|
git config --global user.name 'gemini-cli[bot]'
|
|
git config --global user.email 'gemini-cli[bot]@users.noreply.github.com'
|
|
|
|
- name: 'Checkout PR branch'
|
|
if: |-
|
|
${{ steps.get_context.outputs.is_pr == 'true' }}
|
|
uses: 'actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10' # ratchet:actions/checkout@v4
|
|
with:
|
|
token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
repository: '${{ github.repository }}'
|
|
ref: 'refs/pull/${{ steps.get_context.outputs.issue_number }}/head'
|
|
fetch-depth: 0
|
|
|
|
- name: 'Checkout main branch'
|
|
if: |-
|
|
${{ steps.get_context.outputs.is_pr == 'false' }}
|
|
uses: 'actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10' # ratchet:actions/checkout@v4
|
|
with:
|
|
token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
repository: '${{ github.repository }}'
|
|
fetch-depth: 0
|
|
|
|
- name: 'Acknowledge request'
|
|
env:
|
|
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
ISSUE_NUMBER: '${{ steps.get_context.outputs.issue_number }}'
|
|
REPOSITORY: '${{ github.repository }}'
|
|
REQUEST_TYPE: '${{ steps.get_context.outputs.request_type }}'
|
|
run: |-
|
|
set -euo pipefail
|
|
MESSAGE="I've received your request and I'm working on it now! 🤖"
|
|
if [[ -n "${MESSAGE}" ]]; then
|
|
gh issue comment "${ISSUE_NUMBER}" \
|
|
--body "${MESSAGE}" \
|
|
--repo "${REPOSITORY}"
|
|
fi
|
|
|
|
- name: 'Get description'
|
|
id: 'get_description'
|
|
env:
|
|
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
IS_PR: '${{ steps.get_context.outputs.is_pr }}'
|
|
ISSUE_NUMBER: '${{ steps.get_context.outputs.issue_number }}'
|
|
run: |-
|
|
set -euo pipefail
|
|
if [[ "${IS_PR}" == "true" ]]; then
|
|
DESCRIPTION=$(gh pr view "${ISSUE_NUMBER}" --json body --template '{{.body}}')
|
|
else
|
|
DESCRIPTION=$(gh issue view "${ISSUE_NUMBER}" --json body --template '{{.body}}')
|
|
fi
|
|
{
|
|
echo "description<<EOF"
|
|
echo "${DESCRIPTION}"
|
|
echo "EOF"
|
|
} >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: 'Get comments'
|
|
id: 'get_comments'
|
|
env:
|
|
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
IS_PR: '${{ steps.get_context.outputs.is_pr }}'
|
|
ISSUE_NUMBER: '${{ steps.get_context.outputs.issue_number }}'
|
|
run: |-
|
|
set -euo pipefail
|
|
if [[ "${IS_PR}" == "true" ]]; then
|
|
COMMENTS=$(gh pr view "${ISSUE_NUMBER}" --json comments --template '{{range .comments}}{{.author.login}}: {{.body}}{{"\n"}}{{end}}')
|
|
else
|
|
COMMENTS=$(gh issue view "${ISSUE_NUMBER}" --json comments --template '{{range .comments}}{{.author.login}}: {{.body}}{{"\n"}}{{end}}')
|
|
fi
|
|
{
|
|
echo "comments<<EOF"
|
|
echo "${COMMENTS}"
|
|
echo "EOF"
|
|
} >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: 'Run Gemini'
|
|
id: 'run_gemini'
|
|
uses: 'google-github-actions/run-gemini-cli@v0'
|
|
env:
|
|
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
REPOSITORY: '${{ github.repository }}'
|
|
USER_REQUEST: '${{ steps.get_context.outputs.user_request }}'
|
|
ISSUE_NUMBER: '${{ steps.get_context.outputs.issue_number }}'
|
|
IS_PR: '${{ steps.get_context.outputs.is_pr }}'
|
|
with:
|
|
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
|
|
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
|
|
gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}'
|
|
gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}'
|
|
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
|
|
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
|
|
use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}'
|
|
settings: |-
|
|
{
|
|
"maxSessionTurns": 50,
|
|
"telemetry": {
|
|
"enabled": false,
|
|
"target": "gcp"
|
|
}
|
|
}
|
|
prompt: |-
|
|
## Role
|
|
|
|
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.
|
|
|
|
## Context
|
|
|
|
- **Repository**: `${{ github.repository }}`
|
|
- **Triggering Event**: `${{ github.event_name }}`
|
|
- **Issue/PR Number**: `${{ steps.get_context.outputs.issue_number }}`
|
|
- **Is this a PR?**: `${{ steps.get_context.outputs.is_pr }}`
|
|
- **Issue/PR Description**:
|
|
`${{ steps.get_description.outputs.description }}`
|
|
- **Comments**:
|
|
`${{ steps.get_comments.outputs.comments }}`
|
|
|
|
## User Request
|
|
|
|
The user has sent the following request:
|
|
`${{ steps.get_context.outputs.user_request }}`
|
|
|
|
## How to Respond to Issues, PR Comments, and Questions
|
|
|
|
This workflow supports three main scenarios:
|
|
|
|
1. **Creating a Fix for an Issue**
|
|
- Carefully read the user request and the related issue or PR description.
|
|
- Use available tools to gather all relevant context (e.g., `gh issue view`, `gh pr view`, `gh pr diff`, `cat`, `head`, `tail`).
|
|
- Identify the root cause of the problem before proceeding.
|
|
- **Show and maintain a plan as a checklist**:
|
|
- 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`).
|
|
- Example:
|
|
```
|
|
### Plan
|
|
- [ ] Investigate the root cause
|
|
- [ ] Implement the fix in `file.py`
|
|
- [ ] Add/modify tests
|
|
- [ ] Update documentation
|
|
- [ ] Verify the fix and close the issue
|
|
```
|
|
- Use: `gh pr comment "${ISSUE_NUMBER}" --body "<plan>"` or `gh issue comment "${ISSUE_NUMBER}" --body "<plan>"` to post the initial plan.
|
|
- As you make progress, keep the checklist visible and up to date by editing the same comment (check off completed tasks with `- [x]`).
|
|
- To update the checklist:
|
|
1. Find the comment ID for the checklist (use `gh pr comment list "${ISSUE_NUMBER}"` or `gh issue comment list "${ISSUE_NUMBER}"`).
|
|
2. Edit the comment with the updated checklist:
|
|
- For PRs: `gh pr comment --edit <comment-id> --body "<updated plan>"`
|
|
- For Issues: `gh issue comment --edit <comment-id> --body "<updated plan>"`
|
|
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.
|
|
- If the fix requires code changes, determine which files and lines are affected. If clarification is needed, note any questions for the user.
|
|
- 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.
|
|
- 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.
|
|
- **Branching and Committing**:
|
|
- **NEVER commit directly to the `main` branch.**
|
|
- 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.
|
|
- `git add .`
|
|
- `git commit -m "feat: <describe the change>"`
|
|
- `git push`
|
|
- 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>`.
|
|
- `git checkout -b issue/${ISSUE_NUMBER}/my-fix`
|
|
- `git add .`
|
|
- `git commit -m "feat: <describe the fix>"`
|
|
- `git push origin issue/${ISSUE_NUMBER}/my-fix`
|
|
- After pushing, you can create a pull request: `gh pr create --title "Fixes #${ISSUE_NUMBER}: <short title>" --body "This PR addresses issue #${ISSUE_NUMBER}."`
|
|
- Summarize what was changed and why in a markdown file: `write_file("response.md", "<your response here>")`
|
|
- Post the response as a comment:
|
|
- For PRs: `gh pr comment "${ISSUE_NUMBER}" --body-file response.md`
|
|
- For Issues: `gh issue comment "${ISSUE_NUMBER}" --body-file response.md`
|
|
|
|
2. **Addressing Comments on a Pull Request**
|
|
- Read the specific comment and the context of the PR.
|
|
- Use tools like `gh pr view`, `gh pr diff`, and `cat` to understand the code and discussion.
|
|
- 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.
|
|
- **Committing Changes**: The correct PR branch is already checked out. Simply add, commit, and push your changes.
|
|
- `git add .`
|
|
- `git commit -m "fix: address review comments"`
|
|
- `git push`
|
|
- If the comment is a question, answer it directly and clearly, referencing code or documentation as needed.
|
|
- Document your response in `response.md` and post it as a PR comment: `gh pr comment "${ISSUE_NUMBER}" --body-file response.md`
|
|
|
|
3. **Answering Any Question on an Issue**
|
|
- Read the question and the full issue context using `gh issue view` and related tools.
|
|
- Research or analyze the codebase as needed to provide an accurate answer.
|
|
- 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.**
|
|
- Write a clear, concise answer in `response.md` and post it as an issue comment: `gh issue comment "${ISSUE_NUMBER}" --body-file response.md`
|
|
|
|
## Guidelines
|
|
|
|
- **Be concise and actionable.** Focus on solving the user's problem efficiently.
|
|
- **Always commit and push your changes if you modify code or documentation.**
|
|
- **If you are unsure about the fix or answer, explain your reasoning and ask clarifying questions.**
|
|
- **Follow project conventions and best practices.**
|