Skip to content

Commit 1bd4856

Browse files
authored
chore: simply GitHub Actions permissions (#144)
1 parent 9fdc17b commit 1bd4856

4 files changed

Lines changed: 85 additions & 72 deletions

File tree

.github/workflows/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'

.github/workflows/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

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

Lines changed: 15 additions & 25 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,36 +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-
(
44-
github.event.pull_request.author_association == 'OWNER' ||
45-
github.event.pull_request.author_association == 'MEMBER' ||
46-
github.event.pull_request.author_association == 'COLLABORATOR'
47-
)
43+
(
44+
github.event_name == 'pull_request' &&
45+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
4846
) ||
49-
(github.event_name == 'issue_comment' && github.event.issue.pull_request &&
50-
contains(github.event.comment.body, '@gemini-cli /review') &&
47+
(
5148
(
52-
github.event.comment.author_association == 'OWNER' ||
53-
github.event.comment.author_association == 'MEMBER' ||
54-
github.event.comment.author_association == 'COLLABORATOR'
55-
)
56-
) ||
57-
(github.event_name == 'pull_request_review_comment' &&
49+
(
50+
github.event_name == 'issue_comment' &&
51+
github.event.issue.pull_request
52+
) ||
53+
github.event_name == 'pull_request_review_comment'
54+
) &&
5855
contains(github.event.comment.body, '@gemini-cli /review') &&
59-
(
60-
github.event.comment.author_association == 'OWNER' ||
61-
github.event.comment.author_association == 'MEMBER' ||
62-
github.event.comment.author_association == 'COLLABORATOR'
63-
)
56+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
6457
) ||
65-
(github.event_name == 'pull_request_review' &&
58+
(
59+
github.event_name == 'pull_request_review' &&
6660
contains(github.event.review.body, '@gemini-cli /review') &&
67-
(
68-
github.event.review.author_association == 'OWNER' ||
69-
github.event.review.author_association == 'MEMBER' ||
70-
github.event.review.author_association == 'COLLABORATOR'
71-
)
61+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)
7262
)
7363
timeout-minutes: 5
7464
runs-on: 'ubuntu-latest'
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'run'
2+
3+
on:
4+
pull_request:
5+
types:
6+
- 'opened'
7+
- 'reopened'
8+
pull_request_review:
9+
types:
10+
- 'submitted'
11+
pull_request_review_comment:
12+
types:
13+
- 'created'
14+
issue_comment:
15+
types:
16+
- 'created'
17+
issues:
18+
types:
19+
- 'opened'
20+
- 'reopened'
21+
workflow_dispatch:
22+
23+
24+
permissions:
25+
contents: 'read'
26+
27+
jobs:
28+
debug-permissions:
29+
if: |-
30+
${{ vars.DEBUG_PERMISSIONS }}
31+
name: 'Run'
32+
runs-on: 'ubuntu-latest'
33+
34+
steps:
35+
- shell: 'bash'
36+
env:
37+
DEBUG_EVENT_NAME: '${{ github.event_name }}'
38+
DEBUG_EVENT_ACTION: '${{ github.event.action }}'
39+
DEBUG_EVENT_SENDER_TYPE: '${{ github.event.sender.type }}'
40+
DEBUG_PULL_REQUEST_AUTHOR_ASSOCIATION: '${{ github.event.pull_request.author_association }}'
41+
DEBUG_ISSUE_AUTHOR_ASSOCIATION: '${{ github.event.issue.author_association }}'
42+
DEBUG_COMMENT_AUTHOR_ASSOCIATION: '${{ github.event.comment.author_association }}'
43+
DEBUG_REVIEW_AUTHOR_ASSOCIATION: '${{ github.event.review.author_association }}'
44+
run: |-
45+
echo "event_name: ${DEBUG_EVENT_NAME}"
46+
echo "event.action: ${DEBUG_EVENT_ACTION}"
47+
echo "event.sender.type: ${DEBUG_EVENT_SENDER_TYPE}"
48+
echo "event.pull_request.author_association: ${DEBUG_PULL_REQUEST_AUTHOR_ASSOCIATION}"
49+
echo "event.issue.author_association: ${DEBUG_ISSUE_AUTHOR_ASSOCIATION}"
50+
echo "event.comment.author_association: ${DEBUG_COMMENT_AUTHOR_ASSOCIATION}"
51+
echo "event.review.author_association: ${DEBUG_REVIEW_AUTHOR_ASSOCIATION}"

0 commit comments

Comments
 (0)