Skip to content

Commit 43a726d

Browse files
authored
Simplify the workflow triggers (#146)
Carrying over changes in dogfooding: #144 cc @sethvargo
1 parent 1bd4856 commit 43a726d

File tree

4 files changed

+36
-68
lines changed

4 files changed

+36
-68
lines changed

examples/workflows/gemini-cli/gemini-cli.yml

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,54 +34,26 @@ jobs:
3434
(
3535
github.event_name == 'issues' && github.event.action == 'opened' &&
3636
contains(github.event.issue.body, '@gemini-cli') &&
37-
!contains(github.event.issue.body, '/review') &&
38-
!contains(github.event.issue.body, '/triage') &&
39-
(
40-
github.event.sender.type == 'User' && (
41-
github.event.issue.author_association == 'OWNER' ||
42-
github.event.issue.author_association == 'MEMBER' ||
43-
github.event.issue.author_association == 'COLLABORATOR'
44-
)
45-
)
37+
!contains(github.event.issue.body, '@gemini-cli /review') &&
38+
!contains(github.event.issue.body, '@gemini-cli /triage') &&
39+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association)
4640
) ||
4741
(
48-
github.event_name == 'issue_comment' &&
49-
contains(github.event.comment.body, '@gemini-cli') &&
50-
!contains(github.event.comment.body, '/review') &&
51-
!contains(github.event.comment.body, '/triage') &&
5242
(
53-
github.event.sender.type == 'User' && (
54-
github.event.comment.author_association == 'OWNER' ||
55-
github.event.comment.author_association == 'MEMBER' ||
56-
github.event.comment.author_association == 'COLLABORATOR'
57-
)
58-
)
43+
github.event_name == 'issue_comment' ||
44+
github.event_name == 'pull_request_review_comment'
45+
) &&
46+
contains(github.event.comment.body, '@gemini-cli') &&
47+
!contains(github.event.comment.body, '@gemini-cli /review') &&
48+
!contains(github.event.comment.body, '@gemini-cli /triage') &&
49+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
5950
) ||
6051
(
6152
github.event_name == 'pull_request_review' &&
6253
contains(github.event.review.body, '@gemini-cli') &&
63-
!contains(github.event.review.body, '/review') &&
64-
!contains(github.event.review.body, '/triage') &&
65-
(
66-
github.event.sender.type == 'User' && (
67-
github.event.review.author_association == 'OWNER' ||
68-
github.event.review.author_association == 'MEMBER' ||
69-
github.event.review.author_association == 'COLLABORATOR'
70-
)
71-
)
72-
) ||
73-
(
74-
github.event_name == 'pull_request_review_comment' &&
75-
contains(github.event.comment.body, '@gemini-cli') &&
76-
!contains(github.event.comment.body, '/review') &&
77-
!contains(github.event.comment.body, '/triage') &&
78-
(
79-
github.event.sender.type == 'User' && (
80-
github.event.comment.author_association == 'OWNER' ||
81-
github.event.comment.author_association == 'MEMBER' ||
82-
github.event.comment.author_association == 'COLLABORATOR'
83-
)
84-
)
54+
!contains(github.event.review.body, '@gemini-cli /review') &&
55+
!contains(github.event.review.body, '@gemini-cli /triage') &&
56+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)
8557
)
8658
timeout-minutes: 10
8759
runs-on: 'ubuntu-latest'

examples/workflows/issue-triage/gemini-issue-automated-triage.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ permissions:
3131

3232
jobs:
3333
triage-issue:
34-
if: >
34+
if: |-
3535
github.event_name == 'issues' ||
3636
github.event_name == 'workflow_dispatch' ||
37-
(github.event_name == 'issue_comment' &&
38-
contains(github.event.comment.body, '@gemini-cli /triage') &&
39-
(github.event.comment.author_association == 'OWNER' ||
40-
github.event.comment.author_association == 'MEMBER' ||
41-
github.event.comment.author_association == 'COLLABORATOR'))
37+
(
38+
github.event_name == 'issue_comment' &&
39+
contains(github.event.comment.body, '@gemini-cli /triage') &&
40+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
41+
)
4242
timeout-minutes: 5
4343
runs-on: 'ubuntu-latest'
4444

examples/workflows/pr-review/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ curl -o .github/workflows/gemini-pr-review.yml https://raw.githubusercontent.com
5959

6060
The Gemini PR Review workflow is triggered by:
6161

62-
- **New PRs**: When a pull request is opened
62+
- **New PRs**: When a pull request is opened or reopened
6363
- **PR Review Comments**: When a review comment contains `@gemini-cli /review`
6464
- **PR Reviews**: When a review body contains `@gemini-cli /review`
6565
- **Issue Comments**: When a comment on a PR contains `@gemini-cli /review`

examples/workflows/pr-review/gemini-pr-review.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
types:
66
- 'opened'
7+
- 'reopened'
78
issue_comment:
89
types:
910
- 'created'
@@ -39,30 +40,25 @@ jobs:
3940
review-pr:
4041
if: |-
4142
github.event_name == 'workflow_dispatch' ||
42-
(github.event_name == 'pull_request' && github.event.action == 'opened') ||
43-
(github.event_name == 'issue_comment' && github.event.issue.pull_request &&
44-
contains(github.event.comment.body, '@gemini-cli /review') &&
45-
(
46-
github.event.comment.author_association == 'OWNER' ||
47-
github.event.comment.author_association == 'MEMBER' ||
48-
github.event.comment.author_association == 'COLLABORATOR'
49-
)
43+
(
44+
github.event_name == 'pull_request' &&
45+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
5046
) ||
51-
(github.event_name == 'pull_request_review_comment' &&
52-
contains(github.event.comment.body, '@gemini-cli /review') &&
47+
(
5348
(
54-
github.event.comment.author_association == 'OWNER' ||
55-
github.event.comment.author_association == 'MEMBER' ||
56-
github.event.comment.author_association == 'COLLABORATOR'
57-
)
49+
(
50+
github.event_name == 'issue_comment' &&
51+
github.event.issue.pull_request
52+
) ||
53+
github.event_name == 'pull_request_review_comment'
54+
) &&
55+
contains(github.event.comment.body, '@gemini-cli /review') &&
56+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
5857
) ||
59-
(github.event_name == 'pull_request_review' &&
58+
(
59+
github.event_name == 'pull_request_review' &&
6060
contains(github.event.review.body, '@gemini-cli /review') &&
61-
(
62-
github.event.review.author_association == 'OWNER' ||
63-
github.event.review.author_association == 'MEMBER' ||
64-
github.event.review.author_association == 'COLLABORATOR'
65-
)
61+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)
6662
)
6763
timeout-minutes: 5
6864
runs-on: 'ubuntu-latest'

0 commit comments

Comments
 (0)