-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
84 lines (79 loc) · 3.19 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
name: 'Relgen Action'
description: 'AI-powered PR reviews, descriptions, and labels using relgen'
branding:
icon: 'edit'
color: 'blue'
inputs:
github-token:
description: 'GitHub token'
required: true
llm-key:
description: 'LLM API key'
required: true
llm-provider:
description: 'LLM provider (openai or anthropic)'
required: true
default: 'openai'
llm-model:
description: 'LLM model to use'
required: true
description-template:
description: 'Path to description template file'
required: false
description-prompt:
description: 'Path to description prompt file'
required: false
footer:
description: 'Footer text used to identify relgen comments'
default: |
---
Generated by the [Relgen Action](https://github.com/zlalvani/relgen-action)
required: false
write-mode:
description: 'Where to write the PR description (comma-separated list of: title,comment,description or "off" to disable)'
default: 'comment'
required: false
label-mode:
description: 'How to write labels (add, set, or off)'
default: 'add'
review-mode:
description: 'How to write reviews (add, or off)'
default: 'add'
verbose:
description: 'Enable verbose logging'
required: false
config:
description: 'Path to relgen config file'
required: false
runs:
using: 'composite'
steps:
- name: Install relgen
shell: bash
run: npm install -g relgen@0
- name: Generate PR description
if: inputs.write-mode != 'off'
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
relgen remote pr describe "${{ github.event.pull_request.html_url }}" --provider ${{ inputs.llm-provider }} --model ${{ inputs.llm-model }} \
--write ${{ inputs.write-mode }} \
--llm-token ${{ inputs.llm-key }} \
${{ inputs.footer != '' && format('--footer "{0}"', inputs.footer) || '' }} ${{ inputs.description-template != '' && format('--template {0}', inputs.description-template) || '' }} ${{ inputs.description-prompt != '' && format('--prompt {0}', inputs.description-prompt) || '' }} ${{ inputs.verbose == 'true' && '-v' || '' }} ${{ inputs.config != '' && format('--config {0}', inputs.config) || '' }}
- name: Label PR
if: inputs.label-mode != 'off'
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
relgen remote pr label "${{ github.event.pull_request.html_url }}" --provider ${{ inputs.llm-provider }} --model ${{ inputs.llm-model }} \
--write ${{ inputs.label-mode }} --llm-token ${{ inputs.llm-key }} ${{ inputs.verbose == 'true' && '-v' || '' }} ${{ inputs.config != '' && format('--config {0}', inputs.config) || '' }}
- name: Review PR
if: inputs.review-mode != 'off'
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
relgen remote pr review "${{ github.event.pull_request.html_url }}" --provider ${{ inputs.llm-provider }} --model ${{ inputs.llm-model }} --write \
--llm-token ${{ inputs.llm-key }} ${{ inputs.verbose == 'true' && '-v' || '' }} ${{ inputs.config != '' && format('--config {0}', inputs.config) || '' }}