-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add Gemini CLI workflows #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
WalkthroughAdds four new GitHub Actions workflows integrating Gemini CLI: a general CLI responder, automated issue triage, scheduled triage, and PR review. Each workflow sets permissions, concurrency, conditional triggers, and runs google-github-actions/run-gemini-cli with context extracted via gh CLI and optional GitHub App authentication. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant GitHub as GitHub Events
participant GHA as GitHub Actions (Workflow)
participant GH as GitHub API (gh)
participant Gemini as Gemini CLI
User->>GitHub: Open PR / Issue or comment @gemini-cli
GitHub-->>GHA: Trigger workflow (conditional)
GHA->>GH: Generate App token (optional)
GHA->>GH: Fetch context (issue/PR details, comments)
GHA->>GHA: Checkout repository/branch
GHA->>Gemini: Run with prompt + context + settings
Gemini-->>GH: Perform actions (comments/labels/edits)
GHA-->>User: Acknowledge / post outputs (if configured)
sequenceDiagram
autonumber
participant Cron as Scheduler (cron)
participant GHA as Scheduled Triage Workflow
participant GH as GitHub API (gh)
participant Gemini as Gemini CLI
Cron->>GHA: Hourly trigger
GHA->>GH: List untriaged issues (gh issue list)
GHA->>GHA: Merge/dedupe issues via jq
alt Issues found
GHA->>Gemini: Run triage with ISSUES_TO_TRIAGE
Gemini-->>GH: Apply labels / remove needs-triage
else None
GHA-->>GHA: Exit
end
sequenceDiagram
autonumber
actor Reviewer
participant GitHub as GitHub Events
participant GHA as PR Review Workflow
participant GH as GitHub API (gh)
participant Gemini as Gemini CLI
Reviewer->>GitHub: PR opened / @gemini-cli /review
GitHub-->>GHA: Trigger workflow (guarded)
GHA->>GH: Fetch PR metadata and changed files
GHA->>Gemini: Run review with PR data + settings
Gemini-->>GH: Post review comments/status
GHA-->>Reviewer: Failure comment if errors
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Claude finished @JeongJaeSoon's task —— View job PR Review: Gemini CLI WorkflowsI've completed my review of the 4 Gemini CLI workflow files. Here's my comprehensive feedback: 📋 Review SummaryThis PR adds comprehensive Gemini CLI automation to the repository with 4 well-structured workflow files. The implementation covers interactive CLI functionality, automated issue triage, scheduled maintenance, and PR reviews. The workflows are generally well-designed but have several security and best practices concerns that should be addressed. 🔍 Security Concerns🔴 Critical: Workflow File Modification PermissionsFile:
🟠 High: Broad Shell Command AccessFiles: All workflow files
🟡 Medium: Token Exposure in EnvironmentFiles: All workflow files
🔍 Best Practices Issues🟡 Medium: Concurrency Group InconsistenciesFiles: Multiple workflows
🟡 Medium: Complex Conditional LogicFile:
🟡 Medium: Missing Error HandlingFiles: Multiple workflows
🟠 High: Resource Usage ConcernsFile:
🔍 Code Quality Issues🟢 Low: Hardcoded ValuesFiles: Multiple workflows
🟢 Low: Documentation
🟡 Medium: Action Version PinningFiles: All workflows
🔍 Performance Considerations🟡 Medium: Timeout SettingsFiles: Various workflows
🟢 Low: Unnecessary CheckoutsFile:
🔍 Positive Aspects
🔍 Test Coverage Considerations
📝 Final Recommendations
The workflows are well-implemented overall but should address the security concerns before merging. |
|
There is a problem with the Gemini CLI PR review. Please check the action logs for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (4)
.github/workflows/gemini-issue-automated-triage.yml (1)
103-106: Typo in prompt ("accoridng").Minor typo; polish improves trust.
- cleanup, etc) and their priority (p0, p1, p2, p3). Set the - labels accoridng to the format `kind/*` and `priority/*` patterns. + cleanup, etc) and their priority (p0, p1, p2, p3). Set the + labels according to the format `kind/*` and `priority/*` patterns..github/workflows/gemini-cli.yml (1)
135-142: Remove unused env var (REQUEST_TYPE).REQUEST_TYPE isn’t set anywhere; drop to reduce confusion.
env: GITHUB_ACTOR: '${{ github.actor }}' 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 }}'.github/workflows/gemini-issue-scheduled-triage.yml (1)
66-73: Optional: cap batch size to avoid timeouts.If many issues are found, triage can exceed 5 minutes. Consider triaging a fixed-size batch per run.
Example change (limit to first 25 issues):
- ISSUES="$(echo "${NO_LABEL_ISSUES}" "${NEED_TRIAGE_ISSUES}" | jq -c -s 'add | unique_by(.number)')" + ISSUES="$(echo "${NO_LABEL_ISSUES}" "${NEED_TRIAGE_ISSUES}" | jq -c -s 'add | unique_by(.number) | .[:25]')"Also applies to: 84-97
.github/workflows/gemini-pr-review.yml (1)
63-65: Optional: increase timeout.PR reviews that spin a container and fetch patches often exceed 5 minutes. Consider 10–15 minutes.
- timeout-minutes: 5 + timeout-minutes: 15
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/gemini-cli.yml(1 hunks).github/workflows/gemini-issue-automated-triage.yml(1 hunks).github/workflows/gemini-issue-scheduled-triage.yml(1 hunks).github/workflows/gemini-pr-review.yml(1 hunks)
🔇 Additional comments (1)
.github/workflows/gemini-pr-review.yml (1)
160-184: Verify MCP env interpolation to Docker.The MCP server is started via docker and expects GITHUB_PERSONAL_ACCESS_TOKEN to be passed. Confirm that settings.mcpServers.env values are exported to the docker process so that -e GITHUB_PERSONAL_ACCESS_TOKEN picks it up; some runners don’t interpolate ${GITHUB_TOKEN} inside JSON strings.
Would you like me to add a small probe (that does not print the token) to validate presence inside the container, or refactor to pass the token directly via args using an explicit value expansion?
Also applies to: 200-205
| on: | ||
| pull_request_review_comment: | ||
| types: | ||
| - 'created' | ||
| pull_request_review: | ||
| types: | ||
| - 'submitted' | ||
| issue_comment: | ||
| types: | ||
| - 'created' | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Workflow is missing triggers referenced in job condition.
The job if-condition handles workflow_dispatch and issues events, but the workflow doesn’t declare these triggers. Add them or drop the dead condition branch.
on:
pull_request_review_comment:
types:
- 'created'
pull_request_review:
types:
- 'submitted'
issue_comment:
types:
- 'created'
+ issues:
+ types:
+ - 'opened'
+ workflow_dispatch:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| on: | |
| pull_request_review_comment: | |
| types: | |
| - 'created' | |
| pull_request_review: | |
| types: | |
| - 'submitted' | |
| issue_comment: | |
| types: | |
| - 'created' | |
| on: | |
| pull_request_review_comment: | |
| types: | |
| - 'created' | |
| pull_request_review: | |
| types: | |
| - 'submitted' | |
| issue_comment: | |
| types: | |
| - 'created' | |
| issues: | |
| types: | |
| - 'opened' | |
| workflow_dispatch: |
🤖 Prompt for AI Agents
In .github/workflows/gemini-cli.yml around lines 3 to 13 the workflow declares
pull_request_review_comment, pull_request_review, and issue_comment triggers but
the job's if-condition also checks for workflow_dispatch and issues events which
are not declared; either add the missing triggers or remove the dead branch:
update the on: section to include workflow_dispatch and issues (with the
appropriate types if needed) so the job condition can be true, or simplify the
job if-condition to only reference events declared in this file.
| 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') }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Concurrency group/cancel logic references fields not present for all events.
github.event.issue.number and github.event.issue.author_association are undefined for review events. Add safe fallbacks.
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') }}
+ group: '${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}'
+ cancel-in-progress: >-
+ ${{ github.event.sender.type == 'User' &&
+ contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'),
+ (github.event.issue.author_association ||
+ github.event.comment.author_association ||
+ github.event.review.author_association || '')) }}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 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') }} | |
| concurrency: | |
| group: '${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}' | |
| cancel-in-progress: >- | |
| ${{ github.event.sender.type == 'User' && | |
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), | |
| (github.event.issue.author_association || | |
| github.event.comment.author_association || | |
| github.event.review.author_association || '')) }} |
🤖 Prompt for AI Agents
In .github/workflows/gemini-cli.yml around lines 14 to 18, the concurrency group
and cancel-in-progress expressions assume github.event.issue exists (using
github.event.issue.number and github.event.issue.author_association) which
breaks for review/pull_request events; update the expressions to safely fall
back by using a ternary/OR chain for the group (e.g. use
github.event.issue.number || github.event.pull_request.number || github.run_id)
and guard the cancel-in-progress checks so you only evaluate author_association
when issue or pull_request is present (e.g. check github.event.issue or
github.event.pull_request exists before referencing their author_association),
ensuring undefined fields are not accessed.
| # 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}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Harden output writing for potential newlines in user_request.
Bodies can contain newlines; write outputs using multiline heredoc to avoid truncation.
- {
- echo "user_request=${USER_REQUEST}"
- echo "issue_number=${ISSUE_NUMBER}"
- echo "is_pr=${IS_PR}"
- } >> "${GITHUB_OUTPUT}"
+ {
+ echo "user_request<<EOF"
+ echo "${USER_REQUEST}"
+ echo "EOF"
+ echo "issue_number=${ISSUE_NUMBER}"
+ echo "is_pr=${IS_PR}"
+ } >> "${GITHUB_OUTPUT}"🤖 Prompt for AI Agents
.github/workflows/gemini-cli.yml around lines 102 to 110: the current echo-based
write to GITHUB_OUTPUT will truncate or mangle USER_REQUEST if it contains
newlines; replace the echo block with a single append using a multiline heredoc
to safely emit user_request (preserving newlines) and the other fields into
GITHUB_OUTPUT — write user_request using a unique marker/quoted heredoc so the
variable contents are preserved, then append issue_number and is_pr in the same
heredoc, and ensure proper EOF markers and >> redirection to "${GITHUB_OUTPUT}".
| concurrency: | ||
| group: '${{ github.workflow }}-${{ github.event.issue.number }}' | ||
| cancel-in-progress: true | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix concurrency group for non-issue triggers (workflow_dispatch).
Referencing github.event.issue.number fails for workflow_dispatch (no issue in payload), collapsing runs into the same group or erroring. Use a safe fallback.
-concurrency:
- group: '${{ github.workflow }}-${{ github.event.issue.number }}'
- cancel-in-progress: true
+concurrency:
+ group: '${{ github.workflow }}-${{ github.event.issue.number || github.event.inputs.issue_number || github.run_id }}'
+ cancel-in-progress: true🤖 Prompt for AI Agents
In .github/workflows/gemini-issue-automated-triage.yml around lines 18 to 21,
the concurrency group uses github.event.issue.number which is undefined for
workflow_dispatch runs and causes grouping collisions or errors; change the
expression to provide a safe fallback (for example use github.run_id) so
non-issue triggers work correctly, e.g. replace the group with an expression
that falls back to github.run_id when issue.number is absent: ${{
github.workflow }}-${{ github.event.issue.number || github.run_id }}.
| env: | ||
| GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}' | ||
| ISSUE_TITLE: '${{ github.event.issue.title }}' | ||
| ISSUE_BODY: '${{ github.event.issue.body }}' | ||
| ISSUE_NUMBER: '${{ github.event.issue.number }}' | ||
| REPOSITORY: '${{ github.repository }}' | ||
| with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ISSUE_NUMBER is empty under workflow_dispatch.
The triage step relies on ISSUE_NUMBER, but for workflow_dispatch there is no github.event.issue.number. Provide a fallback to the input.
env:
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
ISSUE_TITLE: '${{ github.event.issue.title }}'
ISSUE_BODY: '${{ github.event.issue.body }}'
- ISSUE_NUMBER: '${{ github.event.issue.number }}'
+ ISSUE_NUMBER: '${{ github.event.issue.number || github.event.inputs.issue_number }}'
REPOSITORY: '${{ github.repository }}'Also applies to: 68-76
🤖 Prompt for AI Agents
In .github/workflows/gemini-issue-automated-triage.yml around lines 61-67 (and
similarly lines 68-76), ISSUE_NUMBER is set from github.event.issue.number which
is empty for workflow_dispatch; update the env assignment to fallback to an
input (e.g. inputs.issue_number) when github.event.issue.number is undefined by
using the expressions operator (or equivalent) to prefer
github.event.issue.number and fall back to the workflow input, and apply the
same fallback for any other ISSUE_* variables that may be missing under
workflow_dispatch so the triage step has a valid ISSUE_NUMBER.
| env: | ||
| GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}' | ||
| GITHUB_REPOSITORY: '${{ github.repository }}' | ||
| GITHUB_OUTPUT: '${{ github.output }}' | ||
| run: |- | ||
| set -euo pipefail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t override GITHUB_OUTPUT; it’s provided by the runner.
Setting GITHUB_OUTPUT to an invalid context breaks step outputs. Remove this env entry.
env:
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
GITHUB_REPOSITORY: '${{ github.repository }}'
- GITHUB_OUTPUT: '${{ github.output }}'🤖 Prompt for AI Agents
In .github/workflows/gemini-issue-scheduled-triage.yml around lines 42 to 47,
the workflow sets GITHUB_OUTPUT in env which overrides the runner-provided
variable and can break step outputs; remove the GITHUB_OUTPUT env entry so the
runner supplies it natively and keep only the needed env entries (GITHUB_TOKEN
and GITHUB_REPOSITORY) or any other custom vars that don’t conflict with
runner-provided names.
| concurrency: | ||
| group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}' | ||
| cancel-in-progress: true | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Make concurrency grouping resilient across all triggers.
Use a reliable key when head_ref/ref may be empty (e.g., review_comment events). Fall back to PR/issue number or run_id.
concurrency:
- group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
+ group: '${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.head_ref || github.ref || github.run_id }}'
cancel-in-progress: true🤖 Prompt for AI Agents
In .github/workflows/gemini-pr-review.yml around lines 24 to 27, the concurrency
group currently uses head_ref/ref which can be empty for some triggers; update
the concurrency.group to fall back to a stable identifier so grouping is
resilient across events — use head_ref then ref, then
github.event.pull_request.number, then github.event.issue.number, and finally
github.run_id as the last resort; keep cancel-in-progress: true.
| - name: 'Get PR details (issue_comment)' | ||
| id: 'get_pr_comment' | ||
| if: |- | ||
| ${{ github.event_name == 'issue_comment' }} | ||
| env: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing PR context for pull_request_review(_comment) events.
For review/review_comment events, neither get_pr nor get_pr_comment runs, leaving PR_NUMBER/PR_DATA/CHANGED_FILES empty. Add a step to populate outputs for these events.
- name: 'Get PR details (issue_comment)'
id: 'get_pr_comment'
if: |-
${{ github.event_name == 'issue_comment' }}
env:
@@
} >> "${GITHUB_OUTPUT}"
+ - name: 'Get PR details (pull_request_review & pull_request_review_comment)'
+ id: 'get_pr_review'
+ if: |-
+ ${{ github.event_name == 'pull_request_review' || github.event_name == 'pull_request_review_comment' }}
+ env:
+ GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
+ EVENT_NAME: '${{ github.event_name }}'
+ PR_NUMBER: '${{ github.event.pull_request.number }}'
+ COMMENT_BODY: '${{ github.event.comment.body }}'
+ REVIEW_BODY: '${{ github.event.review.body }}'
+ run: |-
+ set -euo pipefail
+ echo "pr_number=${PR_NUMBER}" >> "${GITHUB_OUTPUT}"
+ # Extract additional instructions from the review/comment body
+ BODY_SRC="${COMMENT_BODY}"
+ if [[ "${EVENT_NAME}" = "pull_request_review" ]]; then
+ BODY_SRC="${REVIEW_BODY}"
+ fi
+ ADDITIONAL_INSTRUCTIONS="$(echo "${BODY_SRC}" | sed 's/.*@gemini-cli \/review//' | xargs)"
+ echo "additional_instructions=${ADDITIONAL_INSTRUCTIONS}" >> "${GITHUB_OUTPUT}"
+ # Get PR details
+ PR_DATA="$(gh pr view "${PR_NUMBER}" --json title,body,additions,deletions,changedFiles,baseRefName,headRefName)"
+ echo "pr_data=${PR_DATA}" >> "${GITHUB_OUTPUT}"
+ # Get file changes
+ CHANGED_FILES="$(gh pr diff "${PR_NUMBER}" --name-only)"
+ {
+ echo "changed_files<<EOF"
+ echo "${CHANGED_FILES}"
+ echo "EOF"
+ } >> "${GITHUB_OUTPUT}"
- name: 'Run Gemini PR Review'
uses: 'google-github-actions/run-gemini-cli@v0'
id: 'gemini_pr_review'
env:
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
- PR_NUMBER: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number }}'
- PR_DATA: '${{ steps.get_pr.outputs.pr_data || steps.get_pr_comment.outputs.pr_data }}'
- CHANGED_FILES: '${{ steps.get_pr.outputs.changed_files || steps.get_pr_comment.outputs.changed_files }}'
- ADDITIONAL_INSTRUCTIONS: '${{ steps.get_pr.outputs.additional_instructions || steps.get_pr_comment.outputs.additional_instructions }}'
+ PR_NUMBER: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number || steps.get_pr_review.outputs.pr_number }}'
+ PR_DATA: '${{ steps.get_pr.outputs.pr_data || steps.get_pr_comment.outputs.pr_data || steps.get_pr_review.outputs.pr_data }}'
+ CHANGED_FILES: '${{ steps.get_pr.outputs.changed_files || steps.get_pr_comment.outputs.changed_files || steps.get_pr_review.outputs.changed_files }}'
+ ADDITIONAL_INSTRUCTIONS: '${{ steps.get_pr.outputs.additional_instructions || steps.get_pr_comment.outputs.additional_instructions || steps.get_pr_review.outputs.additional_instructions }}'Also applies to: 143-146
🤖 Prompt for AI Agents
.github/workflows/gemini-pr-review.yml around lines 112-116 (and similarly
143-146): the workflow currently only sets PR outputs for issue_comment and
pull_request events, so pull_request_review and pull_request_review_comment
events leave PR_NUMBER/PR_DATA/CHANGED_FILES empty; add a step that runs for
pull_request_review and pull_request_review_comment events which derives the PR
number from the event payload (e.g. github.event.pull_request.number or
github.event.pull_request_review.pull_request.number as appropriate), calls the
GitHub REST API to fetch the PR data and list changed files (same logic as
get_pr/get_pr_comment), and sets the same outputs (PR_NUMBER, PR_DATA,
CHANGED_FILES) so subsequent steps can rely on those variables.
| - name: 'Post PR review failure comment' | ||
| if: |- | ||
| ${{ failure() && steps.gemini_pr_review.outcome == 'failure' }} | ||
| uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' | ||
| with: | ||
| github-token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}' | ||
| script: |- | ||
| github.rest.issues.createComment({ | ||
| owner: '${{ github.repository }}'.split('/')[0], | ||
| repo: '${{ github.repository }}'.split('/')[1], | ||
| issue_number: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number }}', | ||
| body: 'There is a problem with the Gemini CLI PR review. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.' | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure failure-comment resolves PR number for all events.
Add fallback to github.event.pull_request.number so the comment posts for review/review_comment events.
script: |-
github.rest.issues.createComment({
owner: '${{ github.repository }}'.split('/')[0],
repo: '${{ github.repository }}'.split('/')[1],
- issue_number: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number }}',
+ issue_number: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number || github.event.pull_request.number }}',
body: 'There is a problem with the Gemini CLI PR review. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.'
})📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: 'Post PR review failure comment' | |
| if: |- | |
| ${{ failure() && steps.gemini_pr_review.outcome == 'failure' }} | |
| uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' | |
| with: | |
| github-token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}' | |
| script: |- | |
| github.rest.issues.createComment({ | |
| owner: '${{ github.repository }}'.split('/')[0], | |
| repo: '${{ github.repository }}'.split('/')[1], | |
| issue_number: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number }}', | |
| body: 'There is a problem with the Gemini CLI PR review. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.' | |
| }) | |
| - name: 'Post PR review failure comment' | |
| if: |- | |
| ${{ failure() && steps.gemini_pr_review.outcome == 'failure' }} | |
| uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' | |
| with: | |
| github-token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}' | |
| script: |- | |
| github.rest.issues.createComment({ | |
| owner: '${{ github.repository }}'.split('/')[0], | |
| repo: '${{ github.repository }}'.split('/')[1], | |
| issue_number: '${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number || github.event.pull_request.number }}', | |
| body: 'There is a problem with the Gemini CLI PR review. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.' | |
| }) |
🤖 Prompt for AI Agents
.github/workflows/gemini-pr-review.yml around lines 444 to 456: the current
createComment call only falls back to steps.get_pr.outputs.pr_number or
steps.get_pr_comment.outputs.pr_number and can miss events like
review/review_comment; update the issue_number expression to also fall back to
github.event.pull_request.number (e.g. use steps.get_pr.outputs.pr_number ||
steps.get_pr_comment.outputs.pr_number || github.event.pull_request.number) so
the comment can be posted for review/review_comment events; keep the rest of the
call unchanged and ensure the templated string uses the same interpolation style
as the other fields.
Summary by CodeRabbit