git-commit-guard 0.11.0__tar.gz → 0.12.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-guard
3
- Version: 0.11.0
3
+ Version: 0.12.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
@@ -202,6 +202,57 @@ misconfigured range specs in CI. Use `--allow-empty` to exit 0 instead:
202
202
  commit-guard --range origin/main..HEAD --allow-empty
203
203
  ```
204
204
 
205
+ ### GitHub Actions
206
+
207
+ ```yaml
208
+ steps:
209
+ - uses: actions/checkout@v4
210
+ with:
211
+ fetch-depth: 0
212
+ - uses: benner/commit-guard@vX.Y.Z
213
+ ```
214
+
215
+ Check all commits in a pull request:
216
+
217
+ ```yaml
218
+ jobs:
219
+ lint-commits:
220
+ runs-on: ubuntu-latest
221
+ env:
222
+ PR_BASE: ${{ github.event.pull_request.base.sha }}
223
+ PR_HEAD: ${{ github.event.pull_request.head.sha }}
224
+ steps:
225
+ - uses: actions/checkout@v4
226
+ with:
227
+ fetch-depth: 0
228
+ - uses: benner/commit-guard@vX.Y.Z
229
+ with:
230
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
231
+ ```
232
+
233
+ All inputs are optional and mirror the CLI flags:
234
+
235
+ ```yaml
236
+ jobs:
237
+ lint-commits:
238
+ runs-on: ubuntu-latest
239
+ env:
240
+ PR_BASE: ${{ github.event.pull_request.base.sha }}
241
+ PR_HEAD: ${{ github.event.pull_request.head.sha }}
242
+ steps:
243
+ - uses: actions/checkout@v4
244
+ with:
245
+ fetch-depth: 0
246
+ - uses: benner/commit-guard@vX.Y.Z
247
+ with:
248
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
249
+ disable: signed-off,signature
250
+ scopes: auth,api,db
251
+ require-scope: 'true'
252
+ max-subject-length: '100'
253
+ min-description-length: '10'
254
+ ```
255
+
205
256
  ### pre-commit
206
257
 
207
258
  Add to your `.pre-commit-config.yaml`:
@@ -181,6 +181,57 @@ misconfigured range specs in CI. Use `--allow-empty` to exit 0 instead:
181
181
  commit-guard --range origin/main..HEAD --allow-empty
182
182
  ```
183
183
 
184
+ ### GitHub Actions
185
+
186
+ ```yaml
187
+ steps:
188
+ - uses: actions/checkout@v4
189
+ with:
190
+ fetch-depth: 0
191
+ - uses: benner/commit-guard@vX.Y.Z
192
+ ```
193
+
194
+ Check all commits in a pull request:
195
+
196
+ ```yaml
197
+ jobs:
198
+ lint-commits:
199
+ runs-on: ubuntu-latest
200
+ env:
201
+ PR_BASE: ${{ github.event.pull_request.base.sha }}
202
+ PR_HEAD: ${{ github.event.pull_request.head.sha }}
203
+ steps:
204
+ - uses: actions/checkout@v4
205
+ with:
206
+ fetch-depth: 0
207
+ - uses: benner/commit-guard@vX.Y.Z
208
+ with:
209
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
210
+ ```
211
+
212
+ All inputs are optional and mirror the CLI flags:
213
+
214
+ ```yaml
215
+ jobs:
216
+ lint-commits:
217
+ runs-on: ubuntu-latest
218
+ env:
219
+ PR_BASE: ${{ github.event.pull_request.base.sha }}
220
+ PR_HEAD: ${{ github.event.pull_request.head.sha }}
221
+ steps:
222
+ - uses: actions/checkout@v4
223
+ with:
224
+ fetch-depth: 0
225
+ - uses: benner/commit-guard@vX.Y.Z
226
+ with:
227
+ range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
228
+ disable: signed-off,signature
229
+ scopes: auth,api,db
230
+ require-scope: 'true'
231
+ max-subject-length: '100'
232
+ min-description-length: '10'
233
+ ```
234
+
184
235
  ### pre-commit
185
236
 
186
237
  Add to your `.pre-commit-config.yaml`:
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: commit-guard
3
+ description: Conventional commit message linter with imperative mood detection
4
+ author: Nerijus Bendžiūnas
5
+ branding:
6
+ icon: shield
7
+ color: green
8
+ inputs:
9
+ rev:
10
+ description: Commit SHA to check (defaults to HEAD)
11
+ required: false
12
+ range:
13
+ description: Revision range to check (e.g. abc123..HEAD)
14
+ required: false
15
+ enable:
16
+ description: Comma-separated checks to enable
17
+ required: false
18
+ disable:
19
+ description: Comma-separated checks to disable
20
+ required: false
21
+ scopes:
22
+ description: Comma-separated list of allowed scopes
23
+ required: false
24
+ require-scope:
25
+ description: Require a scope in the subject line
26
+ required: false
27
+ default: 'false'
28
+ types:
29
+ description: Comma-separated list of allowed types (replaces defaults)
30
+ required: false
31
+ max-subject-length:
32
+ description: Maximum subject line length (default 72)
33
+ required: false
34
+ min-description-length:
35
+ description: Minimum description length in characters (default 0, off)
36
+ required: false
37
+ allow-empty:
38
+ description: Exit 0 when --range yields no commits
39
+ required: false
40
+ default: 'false'
41
+ include-merges:
42
+ description: Include merge commits when checking a range
43
+ required: false
44
+ default: 'false'
45
+ runs:
46
+ using: composite
47
+ steps:
48
+ - name: Set up uv
49
+ # yamllint disable-line rule:line-length
50
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
51
+ with:
52
+ enable-cache: false
53
+ - name: Install commit-guard
54
+ run: uv tool install git-commit-guard
55
+ shell: bash
56
+ - name: Run commit-guard
57
+ env:
58
+ CG_REV: ${{ inputs.rev }}
59
+ CG_RANGE: ${{ inputs.range }}
60
+ CG_ENABLE: ${{ inputs.enable }}
61
+ CG_DISABLE: ${{ inputs.disable }}
62
+ CG_SCOPES: ${{ inputs.scopes }}
63
+ CG_REQUIRE_SCOPE: ${{ inputs.require-scope }}
64
+ CG_TYPES: ${{ inputs.types }}
65
+ CG_MAX_SUBJECT_LENGTH: ${{ inputs.max-subject-length }}
66
+ CG_MIN_DESCRIPTION_LENGTH: ${{ inputs.min-description-length }}
67
+ CG_ALLOW_EMPTY: ${{ inputs.allow-empty }}
68
+ CG_INCLUDE_MERGES: ${{ inputs.include-merges }}
69
+ run: |
70
+ ARGS=()
71
+ [[ -n "$CG_REV" ]] && ARGS+=("$CG_REV")
72
+ [[ -n "$CG_RANGE" ]] && ARGS+=(--range "$CG_RANGE")
73
+ [[ -n "$CG_ENABLE" ]] && ARGS+=(--enable "$CG_ENABLE")
74
+ [[ -n "$CG_DISABLE" ]] && ARGS+=(--disable "$CG_DISABLE")
75
+ [[ -n "$CG_SCOPES" ]] && ARGS+=(--scopes "$CG_SCOPES")
76
+ [[ "$CG_REQUIRE_SCOPE" == "true" ]] && ARGS+=(--require-scope)
77
+ [[ -n "$CG_TYPES" ]] && ARGS+=(--types "$CG_TYPES")
78
+ [[ -n "$CG_MAX_SUBJECT_LENGTH" ]] && \
79
+ ARGS+=(--max-subject-length "$CG_MAX_SUBJECT_LENGTH")
80
+ [[ -n "$CG_MIN_DESCRIPTION_LENGTH" ]] && \
81
+ ARGS+=(--min-description-length "$CG_MIN_DESCRIPTION_LENGTH")
82
+ [[ "$CG_ALLOW_EMPTY" == "true" ]] && ARGS+=(--allow-empty)
83
+ [[ "$CG_INCLUDE_MERGES" == "true" ]] && ARGS+=(--include-merges)
84
+ commit-guard "${ARGS[@]}"
85
+ shell: bash