-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
108 lines (92 loc) · 3.26 KB
/
action.yml
File metadata and controls
108 lines (92 loc) · 3.26 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
name: "Git Hygiene"
description: "Lint git commit messages for grammar (LanguageTool) and structure quality (LLM)"
author: "Shortcut"
branding:
icon: "check-circle"
color: "green"
inputs:
github-token:
description: "GitHub token for posting PR comments and fetching commits"
required: true
default: ${{ github.token }}
llm-model:
description: >
LLM model name as known to the llm library.
For Ollama (local): e.g. qwen2.5:0.5b, tinyllama, phi3:mini.
For remote providers: e.g. gpt-4o-mini (requires llm-api-key).
Run 'llm models' to see available models.
required: false
default: "qwen2.5:0.5b"
llm-api-key:
description: "API key for a remote LLM provider (e.g. OpenAI). Not required when use-local-model is true."
required: false
default: ""
use-local-model:
description: >
Run the LLM locally on the GitHub Actions runner using Ollama.
No API key needed. Set llm-model to an Ollama model name.
required: false
default: "true"
enable-grammar:
description: "Enable the LanguageTool grammar checker. Disabled by default."
required: false
default: "false"
languagetool-url:
description: "LanguageTool API base URL"
required: false
default: "https://api.languagetool.org/v2"
languagetool-language:
description: "Language code for LanguageTool (e.g. en-US, en-GB, de-DE)"
required: false
default: "en-US"
ignore-patterns:
description: "Newline-separated list of regex patterns for commit messages to skip (e.g. merge commits)"
required: false
default: |
^Merge\s
^Revert\s
custom-words:
description: >
Newline-separated list of words to add to the spell-check dictionary.
Matches where the flagged text is one of these words (case-insensitive) are
suppressed. A built-in list of common dev/tool names is always included.
required: false
default: ""
fail-on-error:
description: "Whether to fail the check (exit 1) when issues are found"
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Python dependencies
shell: bash
run: pip install requests llm llm-ollama
- name: Set up Ollama
if: inputs.use-local-model == 'true'
uses: ai-action/setup-ollama@v2
- name: Pull Ollama model
if: inputs.use-local-model == 'true'
shell: bash
run: |
echo "Pulling Ollama model: ${{ inputs.llm-model }}"
ollama pull ${{ inputs.llm-model }}
- name: Run commit linter
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
LLM_MODEL: ${{ inputs.llm-model }}
LLM_API_KEY: ${{ inputs.llm-api-key }}
ENABLE_GRAMMAR: ${{ inputs.enable-grammar }}
LANGUAGETOOL_URL: ${{ inputs.languagetool-url }}
LANGUAGETOOL_LANGUAGE: ${{ inputs.languagetool-language }}
IGNORE_PATTERNS: ${{ inputs.ignore-patterns }}
CUSTOM_WORDS: ${{ inputs.custom-words }}
FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: python ${{ github.action_path }}/lint_commits.py