git-commit-guard 0.14.0__tar.gz → 0.15.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. git_commit_guard-0.15.0/.editorconfig +23 -0
  2. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.github/workflows/lint-commits.yml +1 -1
  3. git_commit_guard-0.15.0/.markdownlint.json +5 -0
  4. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/PKG-INFO +51 -10
  5. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/README.md +50 -9
  6. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/action.yml +16 -0
  7. git_commit_guard-0.15.0/docs/commit-guard-icon.svg +49 -0
  8. git_commit_guard-0.15.0/docs/index.html +612 -0
  9. git_commit_guard-0.15.0/ruff.toml +17 -0
  10. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/src/git_commit_guard/__init__.py +82 -37
  11. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/tests/test_git_commit_guard.py +139 -12
  12. git_commit_guard-0.14.0/ruff.toml +0 -13
  13. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.github/workflows/lint-md.yml +0 -0
  14. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.github/workflows/lint-python.yml +0 -0
  15. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.github/workflows/release.yml +0 -0
  16. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.github/workflows/test.yml +0 -0
  17. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.gitignore +0 -0
  18. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.pre-commit-hooks.yaml +0 -0
  19. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/.python-version +0 -0
  20. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/LICENSE +0 -0
  21. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/pyproject.toml +0 -0
  22. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/tests/__init__.py +0 -0
  23. {git_commit_guard-0.14.0 → git_commit_guard-0.15.0}/uv.lock +0 -0
@@ -0,0 +1,23 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+
9
+ [*.py]
10
+ indent_style = space
11
+ indent_size = 4
12
+ max_line_length = 88
13
+
14
+ [*.{yml,yaml}]
15
+ indent_style = space
16
+ indent_size = 2
17
+
18
+ [*.toml]
19
+ indent_style = space
20
+ indent_size = 4
21
+
22
+ [*.md]
23
+ trim_trailing_whitespace = false
@@ -22,7 +22,7 @@ jobs:
22
22
  key: nltk-averaged-perceptron-tagger-punkt
23
23
  - name: Lint commits
24
24
  # yamllint disable-line rule:line-length
25
- uses: benner/commit-guard@0f2660f0b4d0ea25b8524acfb459a35e544252cb # v0.13.0
25
+ uses: benner/commit-guard@c3ca496e477d64051d06fdb3aac44d8ffec7e852 # v0.14.1
26
26
  with:
27
27
  range: origin/${{ github.base_ref }}..HEAD
28
28
  disable: signature
@@ -0,0 +1,5 @@
1
+ {
2
+ "MD013": {
3
+ "tables": false
4
+ }
5
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-guard
3
- Version: 0.14.0
3
+ Version: 0.15.0
4
4
  Summary: Opinionated conventional commit message linter with imperative mood detection
5
5
  Project-URL: Homepage, https://github.com/benner/commit-guard
6
6
  Project-URL: Repository, https://github.com/benner/commit-guard
@@ -31,10 +31,9 @@ imperative verb.
31
31
 
32
32
  ```bash
33
33
  $ commit-guard
34
- ✗ subject does not match 'type(scope): description':
35
- Merge pull request #5 from fix/branch
36
- missing 'Signed-off-by' trailer
37
- ✗ commit is not signed (GPG/SSH)
34
+ [subject] subject does not match 'type(scope): description': WIP
35
+ [signed-off] missing 'Signed-off-by' trailer
36
+ [signature] commit is not signed (GPG/SSH)
38
37
  ```
39
38
 
40
39
  ## Installation
@@ -195,6 +194,26 @@ CLI flags (`--enable`, `--disable`, `--scopes`, `--require-scope`, `--types`,
195
194
  `--max-subject-length`, `--min-description-length`, `--require-trailer`) take
196
195
  full precedence and ignore config file values when provided.
197
196
 
197
+ ### Environment variables
198
+
199
+ | Variable | Default | Description |
200
+ | -------------------------- | ------- | -------------------------------------------- |
201
+ | `COMMIT_GUARD_GIT_TIMEOUT` | `10` | Timeout in seconds for git subprocess calls. |
202
+
203
+ ```bash
204
+ COMMIT_GUARD_GIT_TIMEOUT=30 commit-guard --range origin/main..HEAD
205
+ ```
206
+
207
+ In GitHub Actions, set it at the step or job level:
208
+
209
+ ```yaml
210
+ - uses: benner/commit-guard@v0.15.0
211
+ env:
212
+ COMMIT_GUARD_GIT_TIMEOUT: 30
213
+ with:
214
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
215
+ ```
216
+
198
217
  ### Checking a range of commits
199
218
 
200
219
  Use `--range` to check all commits in a revision range. All commits are
@@ -227,7 +246,7 @@ commit-guard --range origin/main..HEAD --allow-empty
227
246
  ### Machine-readable output
228
247
 
229
248
  Use `--output jsonl` to emit one JSON line per commit to stdout instead of the
230
- default human-readable text on stderr:
249
+ default human-readable text:
231
250
 
232
251
  ```bash
233
252
  commit-guard --range origin/main..HEAD --output jsonl
@@ -251,6 +270,16 @@ checks pass. Pipe to `jq` for filtering:
251
270
  commit-guard --range origin/main..HEAD --output jsonl | jq 'select(.ok == false)'
252
271
  ```
253
272
 
273
+ Use `--output-file FILE` to write JSONL to a file while keeping human-readable
274
+ text on stdout:
275
+
276
+ ```bash
277
+ commit-guard --range origin/main..HEAD --output-file results.jsonl
278
+ ```
279
+
280
+ `--output-file` is independent of `--output`: combining both writes JSONL to
281
+ both stdout and the file.
282
+
254
283
  ### GitHub Actions
255
284
 
256
285
  ```yaml
@@ -258,7 +287,7 @@ steps:
258
287
  - uses: actions/checkout@v4
259
288
  with:
260
289
  fetch-depth: 0
261
- - uses: benner/commit-guard@v0.14.0
290
+ - uses: benner/commit-guard@v0.15.0
262
291
  ```
263
292
 
264
293
  Check all commits in a pull request:
@@ -274,7 +303,7 @@ jobs:
274
303
  - uses: actions/checkout@v4
275
304
  with:
276
305
  fetch-depth: 0
277
- - uses: benner/commit-guard@v0.14.0
306
+ - uses: benner/commit-guard@v0.15.0
278
307
  with:
279
308
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
280
309
  ```
@@ -292,7 +321,7 @@ jobs:
292
321
  - uses: actions/checkout@v4
293
322
  with:
294
323
  fetch-depth: 0
295
- - uses: benner/commit-guard@v0.14.0
324
+ - uses: benner/commit-guard@v0.15.0
296
325
  with:
297
326
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
298
327
  disable: signed-off,signature
@@ -301,6 +330,18 @@ jobs:
301
330
  require-trailer: 'Closes,Reviewed-by'
302
331
  max-subject-length: '100'
303
332
  min-description-length: '10'
333
+ output-file: results.jsonl
334
+ ```
335
+
336
+ When `output-file` is set the action exposes the path as an output:
337
+
338
+ ```yaml
339
+ - uses: benner/commit-guard@v0.15.0
340
+ id: cg
341
+ with:
342
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
343
+ output-file: results.jsonl
344
+ - run: jq 'select(.ok == false)' "${{ steps.cg.outputs.output-file }}"
304
345
  ```
305
346
 
306
347
  ### pre-commit
@@ -311,7 +352,7 @@ Add to your `.pre-commit-config.yaml`:
311
352
  ---
312
353
  repos:
313
354
  - repo: https://github.com/benner/commit-guard
314
- rev: v0.14.0
355
+ rev: v0.15.0
315
356
  hooks:
316
357
  - id: commit-guard
317
358
  - id: commit-guard-signature
@@ -10,10 +10,9 @@ imperative verb.
10
10
 
11
11
  ```bash
12
12
  $ commit-guard
13
- ✗ subject does not match 'type(scope): description':
14
- Merge pull request #5 from fix/branch
15
- missing 'Signed-off-by' trailer
16
- ✗ commit is not signed (GPG/SSH)
13
+ [subject] subject does not match 'type(scope): description': WIP
14
+ [signed-off] missing 'Signed-off-by' trailer
15
+ [signature] commit is not signed (GPG/SSH)
17
16
  ```
18
17
 
19
18
  ## Installation
@@ -174,6 +173,26 @@ CLI flags (`--enable`, `--disable`, `--scopes`, `--require-scope`, `--types`,
174
173
  `--max-subject-length`, `--min-description-length`, `--require-trailer`) take
175
174
  full precedence and ignore config file values when provided.
176
175
 
176
+ ### Environment variables
177
+
178
+ | Variable | Default | Description |
179
+ | -------------------------- | ------- | -------------------------------------------- |
180
+ | `COMMIT_GUARD_GIT_TIMEOUT` | `10` | Timeout in seconds for git subprocess calls. |
181
+
182
+ ```bash
183
+ COMMIT_GUARD_GIT_TIMEOUT=30 commit-guard --range origin/main..HEAD
184
+ ```
185
+
186
+ In GitHub Actions, set it at the step or job level:
187
+
188
+ ```yaml
189
+ - uses: benner/commit-guard@v0.15.0
190
+ env:
191
+ COMMIT_GUARD_GIT_TIMEOUT: 30
192
+ with:
193
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
194
+ ```
195
+
177
196
  ### Checking a range of commits
178
197
 
179
198
  Use `--range` to check all commits in a revision range. All commits are
@@ -206,7 +225,7 @@ commit-guard --range origin/main..HEAD --allow-empty
206
225
  ### Machine-readable output
207
226
 
208
227
  Use `--output jsonl` to emit one JSON line per commit to stdout instead of the
209
- default human-readable text on stderr:
228
+ default human-readable text:
210
229
 
211
230
  ```bash
212
231
  commit-guard --range origin/main..HEAD --output jsonl
@@ -230,6 +249,16 @@ checks pass. Pipe to `jq` for filtering:
230
249
  commit-guard --range origin/main..HEAD --output jsonl | jq 'select(.ok == false)'
231
250
  ```
232
251
 
252
+ Use `--output-file FILE` to write JSONL to a file while keeping human-readable
253
+ text on stdout:
254
+
255
+ ```bash
256
+ commit-guard --range origin/main..HEAD --output-file results.jsonl
257
+ ```
258
+
259
+ `--output-file` is independent of `--output`: combining both writes JSONL to
260
+ both stdout and the file.
261
+
233
262
  ### GitHub Actions
234
263
 
235
264
  ```yaml
@@ -237,7 +266,7 @@ steps:
237
266
  - uses: actions/checkout@v4
238
267
  with:
239
268
  fetch-depth: 0
240
- - uses: benner/commit-guard@v0.14.0
269
+ - uses: benner/commit-guard@v0.15.0
241
270
  ```
242
271
 
243
272
  Check all commits in a pull request:
@@ -253,7 +282,7 @@ jobs:
253
282
  - uses: actions/checkout@v4
254
283
  with:
255
284
  fetch-depth: 0
256
- - uses: benner/commit-guard@v0.14.0
285
+ - uses: benner/commit-guard@v0.15.0
257
286
  with:
258
287
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
259
288
  ```
@@ -271,7 +300,7 @@ jobs:
271
300
  - uses: actions/checkout@v4
272
301
  with:
273
302
  fetch-depth: 0
274
- - uses: benner/commit-guard@v0.14.0
303
+ - uses: benner/commit-guard@v0.15.0
275
304
  with:
276
305
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
277
306
  disable: signed-off,signature
@@ -280,6 +309,18 @@ jobs:
280
309
  require-trailer: 'Closes,Reviewed-by'
281
310
  max-subject-length: '100'
282
311
  min-description-length: '10'
312
+ output-file: results.jsonl
313
+ ```
314
+
315
+ When `output-file` is set the action exposes the path as an output:
316
+
317
+ ```yaml
318
+ - uses: benner/commit-guard@v0.15.0
319
+ id: cg
320
+ with:
321
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
322
+ output-file: results.jsonl
323
+ - run: jq 'select(.ok == false)' "${{ steps.cg.outputs.output-file }}"
283
324
  ```
284
325
 
285
326
  ### pre-commit
@@ -290,7 +331,7 @@ Add to your `.pre-commit-config.yaml`:
290
331
  ---
291
332
  repos:
292
333
  - repo: https://github.com/benner/commit-guard
293
- rev: v0.14.0
334
+ rev: v0.15.0
294
335
  hooks:
295
336
  - id: commit-guard
296
337
  - id: commit-guard-signature
@@ -42,6 +42,16 @@ inputs:
42
42
  description: Include merge commits when checking a range
43
43
  required: false
44
44
  default: 'false'
45
+ require-trailer:
46
+ description: Comma-separated list of required trailers (e.g. Closes,Reviewed-by)
47
+ required: false
48
+ output-file:
49
+ description: Write JSONL results to this file path (text still goes to stdout)
50
+ required: false
51
+ outputs:
52
+ output-file:
53
+ description: Path to the JSONL output file (set only when output-file input is provided)
54
+ value: ${{ steps.run.outputs.output-file }}
45
55
  runs:
46
56
  using: composite
47
57
  steps:
@@ -54,6 +64,7 @@ runs:
54
64
  run: uv tool install git-commit-guard
55
65
  shell: bash
56
66
  - name: Run commit-guard
67
+ id: run
57
68
  env:
58
69
  CG_REV: ${{ inputs.rev }}
59
70
  CG_RANGE: ${{ inputs.range }}
@@ -66,6 +77,8 @@ runs:
66
77
  CG_MIN_DESCRIPTION_LENGTH: ${{ inputs.min-description-length }}
67
78
  CG_ALLOW_EMPTY: ${{ inputs.allow-empty }}
68
79
  CG_INCLUDE_MERGES: ${{ inputs.include-merges }}
80
+ CG_REQUIRE_TRAILER: ${{ inputs.require-trailer }}
81
+ CG_OUTPUT_FILE: ${{ inputs.output-file }}
69
82
  run: |
70
83
  ARGS=()
71
84
  [[ -n "$CG_REV" ]] && ARGS+=("$CG_REV")
@@ -81,5 +94,8 @@ runs:
81
94
  ARGS+=(--min-description-length "$CG_MIN_DESCRIPTION_LENGTH")
82
95
  [[ "$CG_ALLOW_EMPTY" == "true" ]] && ARGS+=(--allow-empty)
83
96
  [[ "$CG_INCLUDE_MERGES" == "true" ]] && ARGS+=(--include-merges)
97
+ [[ -n "$CG_REQUIRE_TRAILER" ]] && ARGS+=(--require-trailer "$CG_REQUIRE_TRAILER")
98
+ [[ -n "$CG_OUTPUT_FILE" ]] && ARGS+=(--output-file "$CG_OUTPUT_FILE")
84
99
  commit-guard "${ARGS[@]}"
100
+ [[ -n "$CG_OUTPUT_FILE" ]] && echo "output-file=$CG_OUTPUT_FILE" >> "$GITHUB_OUTPUT"
85
101
  shell: bash
@@ -0,0 +1,49 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
2
+ <defs>
3
+ <linearGradient id="shield_bg" x1="0%" y1="0%" x2="0%" y2="100%">
4
+ <stop offset="0%" style="stop-color:#357ab8;stop-opacity:1" />
5
+ <stop offset="100%" style="stop-color:#1c3d61;stop-opacity:1" />
6
+ </linearGradient>
7
+
8
+ <linearGradient id="shield_bevel" x1="0%" y1="0%" x2="0%" y2="100%">
9
+ <stop offset="0%" style="stop-color:#2a5f94;stop-opacity:1" />
10
+ <stop offset="100%" style="stop-color:#10283f;stop-opacity:1" />
11
+ </linearGradient>
12
+
13
+ <radialGradient id="central_glow" cx="50%" cy="50%" r="50%">
14
+ <stop offset="0%" style="stop-color:#4ac34a;stop-opacity:0.3" />
15
+ <stop offset="100%" style="stop-color:#1c3d61;stop-opacity:0" />
16
+ </radialGradient>
17
+
18
+ <path id="shield_shape" d="M 256,16 C 180,64 120,72 32,72 L 32,256 C 32,400 120,464 256,496 C 392,464 480,400 480,256 L 480,72 C 392,72 332,64 256,16 Z" />
19
+
20
+ <mask id="shield_halfs_mask">
21
+ <use href="#shield_shape" fill="white"/>
22
+ <rect x="256" y="0" width="256" height="512" fill="black"/>
23
+ </mask>
24
+ </defs>
25
+
26
+ <g style="filter:drop-shadow(0px 8px 10px rgba(0,0,0,0.3))">
27
+ <use href="#shield_shape" fill="url(#shield_bevel)" />
28
+
29
+ <path d="M 256,40 C 188,80 134,88 56,88 L 56,256 C 56,384 134,440 256,468 C 378,440 456,384 456,256 L 456,88 C 378,88 324,80 256,40 Z" fill="url(#shield_bg)" />
30
+
31
+ <path d="M 256,40 C 188,80 134,88 56,88 L 56,256 C 56,384 134,440 256,468 L 256,40 Z" fill="#152e4a" opacity="0.4" />
32
+
33
+ <path d="M 256,40 C 188,80 134,88 56,88 L 56,256 C 56,384 134,440 256,468 C 378,440 456,384 456,256 L 456,88 C 378,88 324,80 256,40 Z" stroke="#3d8bd1" stroke-width="6" fill="none" opacity="0.6"/>
34
+
35
+ <g transform="translate(256, 260)">
36
+ <circle r="140" fill="url(#central_glow)" opacity="0.7" />
37
+
38
+ <g transform="translate(0, 15)">
39
+ <path d="M -90,-45 L 0,0 L 0,90 M 90,-45 L 0,0" stroke="#f0f0f0" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" fill="none" />
40
+ <circle cx="-90" cy="-45" r="22" fill="#4ac34a" stroke="#f0f0f0" stroke-width="6" />
41
+ <circle cx="90" cy="-45" r="22" fill="#4ac34a" stroke="#f0f0f0" stroke-width="6" />
42
+ <circle cx="0" cy="0" r="22" fill="#4ac34a" stroke="#f0f0f0" stroke-width="6" />
43
+ <circle cx="0" cy="90" r="22" fill="#4ac34a" stroke="#f0f0f0" stroke-width="6" />
44
+ </g>
45
+
46
+ <path d="M -50,-120 L -10,-80 L 70,-160" stroke="#f0f0f0" stroke-width="20" stroke-linecap="round" stroke-linejoin="round" fill="none" transform="translate(0, 15)" />
47
+ </g>
48
+ </g>
49
+ </svg>