-
Notifications
You must be signed in to change notification settings - Fork 9
57 lines (49 loc) · 1.79 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Name the workflow
name: Code Review
on: [workflow_dispatch]
# on:
# pull_request:
# types: [opened, reopened]
jobs:
# -------------------------------------------------------------
# Event `pull_request`: Returns all changed pull request files.
# --------------------------------------------------------------
changed_files:
# NOTE:
# - This is limited to pull_request* events and would raise an error for other events.
# - A maximum of 3000 files can be returned.
# - For more flexibility and no limitations see "Using local .git history" above.
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Run Code Review
permissions:
pull-requests: read
steps:
- name: Get diff
id: diff
uses: actions/github-script@v6
with:
script: |
const diff_url = context.payload.pull_request.diff_url
const result = await github.request(diff_url)
console.log(result)
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
# Run the code review
- name: Start code review step
id: code_review
uses: aronweiler/codereviewer@main
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF: ${{ github.ref }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_PR: ${{ github.event.number }}
# Use the output from the code_review step
- name: Get the summary
run: echo "Summary- ${{ steps.code_review.outputs.summary }}"