-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
93 lines (86 loc) · 3.12 KB
/
action.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 'Patched PRReview'
description: 'Automatically summarize and comment on PRs in your repository'
branding:
icon: 'git-pull-request'
color: 'orange'
author: '@patched-codes'
inputs:
github_token:
description: 'GitHub token for creating pull requests'
required: false
default: ${{ github.token }}
openai_api_key:
description: 'OpenAI API key for the LLM'
required: false
patched_api_key:
description: 'Patched API key for using Patched services'
required: false
pr_url:
description: 'URL of the pull request to review'
required: true
default: ${{ github.event.pull_request.html_url }}
model:
description: 'LLM model to use'
required: false
client_base_url:
description: 'Base URL for the LLM API'
required: false
diff_suggestion:
description: 'Whether to generate suggestions to improve the PR'
required: false
diff_summary:
description: 'Length of the summary (long, short, none)'
required: false
model_temperature:
description: 'Temperature parameter for the LLM'
required: false
model_top_p:
description: 'Top-p parameter for the LLM'
required: false
model_max_tokens:
description: 'Maximum tokens for the LLM response'
required: false
outputs:
comment_url:
description: 'URL of the created PR comment'
value: ${{ steps.pr-review.outputs.comment_url }}
runs:
using: 'composite'
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Restore pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-patchwork-cli
restore-keys: |
${{ runner.os }}-pip-patchwork-cli
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install patchwork-cli
- name: Generate config
shell: bash
run: |
cat > config.yml << EOF
github_api_key: "${{ inputs.github_token }}"
$([ -n "${{ inputs.openai_api_key }}" ] && echo "openai_api_key: \"${{ inputs.openai_api_key }}\"")
$([ -n "${{ inputs.patched_api_key }}" ] && echo "patched_api_key: \"${{ inputs.patched_api_key }}\"")
$([ -n "${{ inputs.pr_url }}" ] && echo "pr_url: \"${{ inputs.pr_url }}\"")
$([ -n "${{ inputs.model }}" ] && echo "model: \"${{ inputs.model }}\"")
$([ -n "${{ inputs.client_base_url }}" ] && echo "client_base_url: \"${{ inputs.client_base_url }}\"")
$([ -n "${{ inputs.diff_suggestion }}" ] && echo "diff_suggestion: ${{ inputs.diff_suggestion }}")
$([ -n "${{ inputs.diff_summary }}" ] && echo "diff_summary: \"${{ inputs.diff_summary }}\"")
$([ -n "${{ inputs.model_temperature }}" ] && echo "model_temperature: ${{ inputs.model_temperature }}")
$([ -n "${{ inputs.model_top_p }}" ] && echo "model_top_p: ${{ inputs.model_top_p }}")
$([ -n "${{ inputs.model_max_tokens }}" ] && echo "model_max_tokens: ${{ inputs.model_max_tokens }}")
EOF
- name: Run PRReview
id: pr-review
shell: bash
run: |
patchwork PRReview --config config.yml