git-commit-guard 0.14.1__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.1 → 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.1 → git_commit_guard-0.15.0}/PKG-INFO +48 -6
  5. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/README.md +47 -5
  6. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/action.yml +11 -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.1 → git_commit_guard-0.15.0}/src/git_commit_guard/__init__.py +82 -37
  11. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/tests/test_git_commit_guard.py +139 -12
  12. git_commit_guard-0.14.1/ruff.toml +0 -13
  13. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.github/workflows/lint-md.yml +0 -0
  14. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.github/workflows/lint-python.yml +0 -0
  15. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.github/workflows/release.yml +0 -0
  16. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.github/workflows/test.yml +0 -0
  17. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.gitignore +0 -0
  18. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.pre-commit-hooks.yaml +0 -0
  19. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/.python-version +0 -0
  20. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/LICENSE +0 -0
  21. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/pyproject.toml +0 -0
  22. {git_commit_guard-0.14.1 → git_commit_guard-0.15.0}/tests/__init__.py +0 -0
  23. {git_commit_guard-0.14.1 → 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@ccb4e549f589787e294199688f20b5cb5fcac1e1 # v0.14.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.1
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
@@ -194,6 +194,26 @@ CLI flags (`--enable`, `--disable`, `--scopes`, `--require-scope`, `--types`,
194
194
  `--max-subject-length`, `--min-description-length`, `--require-trailer`) take
195
195
  full precedence and ignore config file values when provided.
196
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
+
197
217
  ### Checking a range of commits
198
218
 
199
219
  Use `--range` to check all commits in a revision range. All commits are
@@ -226,7 +246,7 @@ commit-guard --range origin/main..HEAD --allow-empty
226
246
  ### Machine-readable output
227
247
 
228
248
  Use `--output jsonl` to emit one JSON line per commit to stdout instead of the
229
- default human-readable text on stderr:
249
+ default human-readable text:
230
250
 
231
251
  ```bash
232
252
  commit-guard --range origin/main..HEAD --output jsonl
@@ -250,6 +270,16 @@ checks pass. Pipe to `jq` for filtering:
250
270
  commit-guard --range origin/main..HEAD --output jsonl | jq 'select(.ok == false)'
251
271
  ```
252
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
+
253
283
  ### GitHub Actions
254
284
 
255
285
  ```yaml
@@ -257,7 +287,7 @@ steps:
257
287
  - uses: actions/checkout@v4
258
288
  with:
259
289
  fetch-depth: 0
260
- - uses: benner/commit-guard@v0.14.1
290
+ - uses: benner/commit-guard@v0.15.0
261
291
  ```
262
292
 
263
293
  Check all commits in a pull request:
@@ -273,7 +303,7 @@ jobs:
273
303
  - uses: actions/checkout@v4
274
304
  with:
275
305
  fetch-depth: 0
276
- - uses: benner/commit-guard@v0.14.1
306
+ - uses: benner/commit-guard@v0.15.0
277
307
  with:
278
308
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
279
309
  ```
@@ -291,7 +321,7 @@ jobs:
291
321
  - uses: actions/checkout@v4
292
322
  with:
293
323
  fetch-depth: 0
294
- - uses: benner/commit-guard@v0.14.1
324
+ - uses: benner/commit-guard@v0.15.0
295
325
  with:
296
326
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
297
327
  disable: signed-off,signature
@@ -300,6 +330,18 @@ jobs:
300
330
  require-trailer: 'Closes,Reviewed-by'
301
331
  max-subject-length: '100'
302
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 }}"
303
345
  ```
304
346
 
305
347
  ### pre-commit
@@ -310,7 +352,7 @@ Add to your `.pre-commit-config.yaml`:
310
352
  ---
311
353
  repos:
312
354
  - repo: https://github.com/benner/commit-guard
313
- rev: v0.14.1
355
+ rev: v0.15.0
314
356
  hooks:
315
357
  - id: commit-guard
316
358
  - id: commit-guard-signature
@@ -173,6 +173,26 @@ CLI flags (`--enable`, `--disable`, `--scopes`, `--require-scope`, `--types`,
173
173
  `--max-subject-length`, `--min-description-length`, `--require-trailer`) take
174
174
  full precedence and ignore config file values when provided.
175
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
+
176
196
  ### Checking a range of commits
177
197
 
178
198
  Use `--range` to check all commits in a revision range. All commits are
@@ -205,7 +225,7 @@ commit-guard --range origin/main..HEAD --allow-empty
205
225
  ### Machine-readable output
206
226
 
207
227
  Use `--output jsonl` to emit one JSON line per commit to stdout instead of the
208
- default human-readable text on stderr:
228
+ default human-readable text:
209
229
 
210
230
  ```bash
211
231
  commit-guard --range origin/main..HEAD --output jsonl
@@ -229,6 +249,16 @@ checks pass. Pipe to `jq` for filtering:
229
249
  commit-guard --range origin/main..HEAD --output jsonl | jq 'select(.ok == false)'
230
250
  ```
231
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
+
232
262
  ### GitHub Actions
233
263
 
234
264
  ```yaml
@@ -236,7 +266,7 @@ steps:
236
266
  - uses: actions/checkout@v4
237
267
  with:
238
268
  fetch-depth: 0
239
- - uses: benner/commit-guard@v0.14.1
269
+ - uses: benner/commit-guard@v0.15.0
240
270
  ```
241
271
 
242
272
  Check all commits in a pull request:
@@ -252,7 +282,7 @@ jobs:
252
282
  - uses: actions/checkout@v4
253
283
  with:
254
284
  fetch-depth: 0
255
- - uses: benner/commit-guard@v0.14.1
285
+ - uses: benner/commit-guard@v0.15.0
256
286
  with:
257
287
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
258
288
  ```
@@ -270,7 +300,7 @@ jobs:
270
300
  - uses: actions/checkout@v4
271
301
  with:
272
302
  fetch-depth: 0
273
- - uses: benner/commit-guard@v0.14.1
303
+ - uses: benner/commit-guard@v0.15.0
274
304
  with:
275
305
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
276
306
  disable: signed-off,signature
@@ -279,6 +309,18 @@ jobs:
279
309
  require-trailer: 'Closes,Reviewed-by'
280
310
  max-subject-length: '100'
281
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 }}"
282
324
  ```
283
325
 
284
326
  ### pre-commit
@@ -289,7 +331,7 @@ Add to your `.pre-commit-config.yaml`:
289
331
  ---
290
332
  repos:
291
333
  - repo: https://github.com/benner/commit-guard
292
- rev: v0.14.1
334
+ rev: v0.15.0
293
335
  hooks:
294
336
  - id: commit-guard
295
337
  - id: commit-guard-signature
@@ -45,6 +45,13 @@ inputs:
45
45
  require-trailer:
46
46
  description: Comma-separated list of required trailers (e.g. Closes,Reviewed-by)
47
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 }}
48
55
  runs:
49
56
  using: composite
50
57
  steps:
@@ -57,6 +64,7 @@ runs:
57
64
  run: uv tool install git-commit-guard
58
65
  shell: bash
59
66
  - name: Run commit-guard
67
+ id: run
60
68
  env:
61
69
  CG_REV: ${{ inputs.rev }}
62
70
  CG_RANGE: ${{ inputs.range }}
@@ -70,6 +78,7 @@ runs:
70
78
  CG_ALLOW_EMPTY: ${{ inputs.allow-empty }}
71
79
  CG_INCLUDE_MERGES: ${{ inputs.include-merges }}
72
80
  CG_REQUIRE_TRAILER: ${{ inputs.require-trailer }}
81
+ CG_OUTPUT_FILE: ${{ inputs.output-file }}
73
82
  run: |
74
83
  ARGS=()
75
84
  [[ -n "$CG_REV" ]] && ARGS+=("$CG_REV")
@@ -86,5 +95,7 @@ runs:
86
95
  [[ "$CG_ALLOW_EMPTY" == "true" ]] && ARGS+=(--allow-empty)
87
96
  [[ "$CG_INCLUDE_MERGES" == "true" ]] && ARGS+=(--include-merges)
88
97
  [[ -n "$CG_REQUIRE_TRAILER" ]] && ARGS+=(--require-trailer "$CG_REQUIRE_TRAILER")
98
+ [[ -n "$CG_OUTPUT_FILE" ]] && ARGS+=(--output-file "$CG_OUTPUT_FILE")
89
99
  commit-guard "${ARGS[@]}"
100
+ [[ -n "$CG_OUTPUT_FILE" ]] && echo "output-file=$CG_OUTPUT_FILE" >> "$GITHUB_OUTPUT"
90
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>