Skip to content

Commit f7c66ad

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 f7c66ad

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/gemini-dispatch.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,20 @@ jobs:
4343
env | grep '^DEBUG_'
4444
4545
dispatch:
46+
# For PRs: only if not from a fork
47+
# For comments: only if user types @gemini-cli and is OWNER/MEMBER/COLLABORATOR
48+
# For issues: only on open/reopen
4649
if: |-
4750
(
4851
github.event_name == 'pull_request' &&
49-
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
50-
) || (
52+
github.event.pull_request.head.repo.fork == false
53+
) ||
54+
(
5155
github.event.sender.type == 'User' &&
5256
startsWith(github.event.comment.body || github.event.review.body || github.event.issue.body, '@gemini-cli') &&
5357
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association || github.event.review.author_association || github.event.issue.author_association)
54-
) || (
58+
) ||
59+
(
5560
github.event_name == 'issues' &&
5661
contains(fromJSON('["opened", "reopened"]'), github.event.action)
5762
)

0 commit comments

Comments
 (0)