-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
114 lines (100 loc) · 3.36 KB
/
action.yml
File metadata and controls
114 lines (100 loc) · 3.36 KB
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
114
name: 'AI Commit Message Generator'
description: 'Automatically generate or improve git commit messages using AI (powered by aicommit)'
author: 'suenot'
branding:
icon: 'git-commit'
color: 'purple'
inputs:
api_key:
description: 'OpenRouter API key for AI model access'
required: true
provider:
description: 'AI provider to use (openrouter, simple-free, ollama, openai-compatible)'
required: false
default: 'simple-free'
model:
description: 'Specific model to use (optional, provider will auto-select if not specified)'
required: false
mode:
description: 'Operating mode: generate (generate message for staged changes) or analyze (analyze push commits)'
required: false
default: 'generate'
output_format:
description: 'Output format: text, json, or github'
required: false
default: 'github'
max_tokens:
description: 'Maximum tokens for response'
required: false
default: '200'
temperature:
description: 'Temperature for generation (0.0-1.0)'
required: false
default: '0.2'
diff_file:
description: 'Path to a file containing the diff (optional)'
required: false
outputs:
commit_message:
description: 'Generated commit message'
model_used:
description: 'AI model that was used for generation'
input_tokens:
description: 'Number of input tokens used'
output_tokens:
description: 'Number of output tokens generated'
total_cost:
description: 'Total cost of the API call'
success:
description: 'Whether the generation was successful'
error:
description: 'Error message if generation failed'
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install aicommit
shell: bash
run: npm install -g @suenot/aicommit
- name: Generate commit message (staged changes)
if: ${{ inputs.mode == 'generate' }}
shell: bash
env:
OPENROUTER_API_KEY: ${{ inputs.api_key }}
AICOMMIT_PROVIDER: ${{ inputs.provider }}
AICOMMIT_MODEL: ${{ inputs.model }}
run: |
ARGS="--github-action --output-format=${{ inputs.output_format }}"
ARGS="$ARGS --max-tokens=${{ inputs.max_tokens }}"
ARGS="$ARGS --temperature=${{ inputs.temperature }}"
if [ -n "${{ inputs.diff_file }}" ]; then
ARGS="$ARGS --input-diff=${{ inputs.diff_file }}"
fi
if [ -n "${{ inputs.model }}" ]; then
ARGS="$ARGS --model=${{ inputs.model }}"
fi
if [ -n "${{ inputs.provider }}" ]; then
ARGS="$ARGS --provider=${{ inputs.provider }}"
fi
aicommit $ARGS
- name: Analyze commits (push event)
if: ${{ inputs.mode == 'analyze' }}
shell: bash
env:
OPENROUTER_API_KEY: ${{ inputs.api_key }}
AICOMMIT_PROVIDER: ${{ inputs.provider }}
AICOMMIT_MODEL: ${{ inputs.model }}
run: |
ARGS="--github-action --analyze-commits --output-format=${{ inputs.output_format }}"
ARGS="$ARGS --max-tokens=${{ inputs.max_tokens }}"
ARGS="$ARGS --temperature=${{ inputs.temperature }}"
if [ -n "${{ inputs.model }}" ]; then
ARGS="$ARGS --model=${{ inputs.model }}"
fi
if [ -n "${{ inputs.provider }}" ]; then
ARGS="$ARGS --provider=${{ inputs.provider }}"
fi
aicommit $ARGS