Skip to content

Commit 32e7402

Browse files
authored
feat: add imperative mood (#121)
1 parent 3044b4a commit 32e7402

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

.github/workflows/commit-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ jobs:
2626
author-email: true
2727
commit-signoff: true
2828
merge-base: true
29+
imperative: true
2930
job-summary: true
3031
pr-comments: ${{ github.event_name == 'pull_request' }}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
author-email: true
5252
commit-signoff: true
5353
merge-base: false
54+
imperative: true
5455
job-summary: true
5556
pr-comments: ${{ github.event_name == 'pull_request' }}
5657
```
@@ -114,6 +115,11 @@ jobs:
114115
>
115116
> To use this feature, you need fetch all history for all branches by setting `fetch-depth: 0` in `actions/checkout`.
116117

118+
### `imperative`
119+
120+
- **Description**: check commit message is imperative mood.
121+
- Default: `true`
122+
117123
### `dry-run`
118124

119125
- **Description**: run checks without failing. exit code is 0 otherwise is 1.

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ inputs:
2929
description: check current branch is rebased onto target branch
3030
required: false
3131
default: false
32+
imperative:
33+
description: check commit message is in imperative mood
34+
required: false
35+
default: true
3236
dry-run:
3337
description: run checks without failing
3438
required: false
@@ -76,6 +80,7 @@ runs:
7680
AUTHOR_EMAIL: ${{ inputs.author-email }}
7781
COMMIT_SIGNOFF: ${{ inputs.commit-signoff }}
7882
MERGE_BASE: ${{ inputs.merge-base }}
83+
IMPERATIVE: ${{ inputs.imperative }}
7984
DRY_RUN: ${{ inputs.dry-run }}
8085
JOB_SUMMARY: ${{ inputs.job-summary }}
8186
PR_COMMENTS: ${{ inputs.pr-comments }}

main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
AUTHOR_EMAIL = os.getenv("AUTHOR_EMAIL", "false")
1818
COMMIT_SIGNOFF = os.getenv("COMMIT_SIGNOFF", "false")
1919
MERGE_BASE = os.getenv("MERGE_BASE", "false")
20+
IMPERATIVE = os.getenv("IMPERATIVE", "true")
2021
DRY_RUN = os.getenv("DRY_RUN", "false")
2122
JOB_SUMMARY = os.getenv("JOB_SUMMARY", "false")
2223
PR_COMMENTS = os.getenv("PR_COMMENTS", "false")
@@ -34,6 +35,7 @@ def log_env_vars():
3435
print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}")
3536
print(f"COMMIT_SIGNOFF = {COMMIT_SIGNOFF}")
3637
print(f"MERGE_BASE = {MERGE_BASE}")
38+
print(f"IMPERATIVE = {IMPERATIVE}")
3739
print(f"DRY_RUN = {DRY_RUN}")
3840
print(f"JOB_SUMMARY = {JOB_SUMMARY}")
3941
print(f"PR_COMMENTS = {PR_COMMENTS}\n")
@@ -48,12 +50,21 @@ def run_commit_check() -> int:
4850
"--author-email",
4951
"--commit-signoff",
5052
"--merge-base",
53+
"--imperative",
5154
]
5255
args = [
5356
arg
5457
for arg, value in zip(
5558
args,
56-
[MESSAGE, BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, COMMIT_SIGNOFF, MERGE_BASE],
59+
[
60+
MESSAGE,
61+
BRANCH,
62+
AUTHOR_NAME,
63+
AUTHOR_EMAIL,
64+
COMMIT_SIGNOFF,
65+
MERGE_BASE,
66+
IMPERATIVE,
67+
],
5768
)
5869
if value == "true"
5970
]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy