Skip to content

Conversation

yongruilin
Copy link
Collaborator

Trigger only when "api-review" is labeled on the PR

@@ -2,11 +2,12 @@ name: Gemini PR Review

on:
pull_request_target:
types: [opened, synchronize]
types: [opened, synchronize, labeled]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Add a condition to only run this job when a specific label (e.g., api-review) is present on the pull request. This prevents the Gemini review from running on every PR, reducing unnecessary load. Add a comment to explain to the user what the job does.


jobs:
gemini_review:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'api-review')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Use pull_request instead of pull_request_target. The pull_request_target event has security implications. It is designed to be used with caution, mainly when the workflow needs access to secrets or write access to the repository based on untrusted code. The standard pull_request event is usually sufficient and safer. For example: if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'api-review')

@richabanker richabanker merged commit 8a08f21 into richabanker:hackathon Feb 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants