Skip to content

Commit 42aebf8

Browse files
committed
Auto trigger PR reviews when they are from branches in repo
Pull request events identify members as "contributors", so the workflows are not auto-triggered. But there are some contributors who are not members, so workflows would fail on forks. In this change, we switch the condition for PR events to check for whether the PR was created from a branch in the repo or from a fork. Note that only users with write access to the repo can create branches.
1 parent e4b0716 commit 42aebf8

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/gemini-dispatch.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ jobs:
4444
4545
dispatch:
4646
if: |-
47+
# For PRs: only if not from a fork
4748
(
4849
github.event_name == 'pull_request' &&
49-
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
50-
) || (
50+
github.event.pull_request.head.repo.fork == false
51+
) ||
52+
# For comments: only if user types @gemini-cli and is OWNER/MEMBER/COLLABORATOR
53+
(
5154
github.event.sender.type == 'User' &&
5255
startsWith(github.event.comment.body || github.event.review.body || github.event.issue.body, '@gemini-cli') &&
5356
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association || github.event.review.author_association || github.event.issue.author_association)
54-
) || (
57+
) ||
58+
# For issues: only on open/reopen
59+
(
5560
github.event_name == 'issues' &&
5661
contains(fromJSON('["opened", "reopened"]'), github.event.action)
5762
)

0 commit comments

Comments
 (0)