Skip to content

Commit febef35

Browse files
authored
add auto gemini review comment workflow (#38309)
* add auto gemini review comment workflow * add workflow dispatch * add pr number input option * remove comment * make pull request target * add back opened type
1 parent 281270c commit febef35

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: Gemini Review Comment
17+
18+
on:
19+
workflow_dispatch:
20+
inputs:
21+
pr_number:
22+
description: 'The Pull Request number to review'
23+
required: true
24+
type: string
25+
pull_request_target:
26+
types: [ opened ]
27+
branches: [ master ]
28+
29+
jobs:
30+
add-comment:
31+
runs-on: ubuntu-latest
32+
permissions:
33+
pull-requests: write
34+
steps:
35+
- uses: actions/github-script@v8
36+
with:
37+
script: |
38+
const prNumber = context.payload.pull_request?.number || context.payload.inputs?.pr_number;
39+
40+
if (!prNumber) {
41+
throw new Error("Could not find a PR number from context or inputs.");
42+
}
43+
44+
await github.rest.issues.createComment({
45+
issue_number: parseInt(prNumber),
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
body: '/gemini review'
49+
});

0 commit comments

Comments
 (0)