-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
70 lines (67 loc) · 2.65 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
# action.yml
name: "Commit Meaning"
description: "In a paragraph, describe the commits for a PR."
branding:
icon: "git-pull-request"
color: "purple"
inputs:
openai-api-key: # id of input
description: "Your OpenAI API key."
required: true
openai-org: # openai organization id
description: "Your OpenAI organization id."
required: true
temperature:
description: "The OpenAI temperature parameter"
required: true
default: .7
tokens:
description: "The OpenAI tokens parameter"
required: true
default: 256
frequency-penalty:
description: "The OpenAI frequency_penalty parameter"
required: true
default: 0
presence-penalty:
description: "The OpenAI presence_penalty parameter"
required: true
default: 0
prompt-instructions:
description: "Additional input instructions for the prompt"
required: true
default: ":bug: refers to a bug fix, :lady_bug: refers to a bug fix, :recycle: means to refactor code or to refactor content, :sparkles: means something is new in the code, :wrench: refers to code that is configuration or low-level in nature, :fire: means to remove code or remove content, :construction: references a commit considered to be work in-progress, and :notebook: references changes to documentation."
outputs:
description: # id of output
description: "The PR commit log description."
value: ${{ steps.get-commit-meaning.outputs.description }}
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Dependencies
run: cd ${{ github.action_path }} && pip install -r requirements.txt
shell: bash
- name: Pass inputs to shell
run: |
echo "INPUT_OPENAIAPIKEY=${{ inputs.openai-api-key }}" >> $GITHUB_ENV
echo "INPUT_OPENAIORG=${{ inputs.openai-org }}" >> $GITHUB_ENV
echo "INPUT_TEMPERATURE=${{ inputs.temperature }}" >> $GITHUB_ENV
echo "INPUT_TOKENS=${{ inputs.tokens }}" >> $GITHUB_ENV
echo "INPUT_FREQUENCYPENALTY=${{ inputs.frequency-penalty }}" >> $GITHUB_ENV
echo "INPUT_PRESENCEPENALTY=${{ inputs.presencce-penalty }}" >> $GITHUB_ENV
echo "INPUT_PROMPTINSTRUCTIONS=${{ inputs.prompt-instructions }}" >> $GITHUB_ENV
shell: bash
- name: Get commit meaning
id: get-commit-meaning
run: |
action_path=${{ github.action_path }}
output=$(cd ${action_path} && python main.py)
output=$(cd ${action_path} && echo ${output@Q} | sed "s/^.//" | sed "s/.$//")
echo "::set-output name=description::${output}"
shell: bash