-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
113 lines (106 loc) · 4.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: 'Patched GenerateREADME'
description: 'Generate documentation for a folder in your repository in form of a README.md file'
branding:
icon: 'book'
color: 'blue'
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
folder_path:
description: 'Path to the folder to generate documentation for'
required: true
model:
description: 'LLM model to use'
required: false
client_base_url:
description: 'Base URL for the LLM API'
required: false
filter:
description: 'Filter for the kind of files to include'
required: false
suppress_comments:
description: 'Whether to suppress comments in the documentation'
required: false
markdown_file_name:
description: 'Name of the generated markdown file'
required: false
branch_prefix:
description: 'Prefix for the created branch'
required: false
default: 'patched-generate-readme/'
disable_branch:
description: 'Disable creating new branches'
required: false
disable_pr:
description: 'Disable creating pull requests'
required: false
force_pr_creation:
description: 'Force push commits to existing PR'
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:
pr_url:
description: 'URL of the created pull request'
value: ${{ steps.generate-readme.outputs.pr_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 code2prompt
- 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.folder_path }}" ] && echo "folder_path: \"${{ inputs.folder_path }}\"")
$([ -n "${{ inputs.model }}" ] && echo "model: \"${{ inputs.model }}\"")
$([ -n "${{ inputs.client_base_url }}" ] && echo "client_base_url: \"${{ inputs.client_base_url }}\"")
$([ -n "${{ inputs.filter }}" ] && echo "filter: \"${{ inputs.filter }}\"")
$([ -n "${{ inputs.suppress_comments }}" ] && echo "suppress_comments: ${{ inputs.suppress_comments }}")
$([ -n "${{ inputs.markdown_file_name }}" ] && echo "markdown_file_name: \"${{ inputs.markdown_file_name }}\"")
$([ -n "${{ inputs.branch_prefix }}" ] && echo "branch_prefix: \"${{ inputs.branch_prefix }}\"")
$([ -n "${{ inputs.disable_branch }}" ] && echo "disable_branch: ${{ inputs.disable_branch }}")
$([ -n "${{ inputs.disable_pr }}" ] && echo "disable_pr: ${{ inputs.disable_pr }}")
$([ -n "${{ inputs.force_pr_creation }}" ] && echo "force_pr_creation: ${{ inputs.force_pr_creation }}")
$([ -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 GenerateREADME
id: generate-readme
shell: bash
run: |
patchwork GenerateREADME --config config.yml