Skip to content

Commit af37fa3

Browse files
committed
Fix action and update default values
1 parent 3f7bf4f commit af37fa3

File tree

3 files changed

+30
-37
lines changed

3 files changed

+30
-37
lines changed

README.md

+22-29
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ created or when it gets updated.
77

88
## Usage
99

10-
Create the file `.github/workflows/gitlint.yaml` in your repository and add the following workflow:
10+
Create the file `.github/workflows/linters.yaml` in your repository and add the following workflow:
1111

1212
```yaml
13-
name: GitLint
13+
name: Linters
1414

1515
on:
1616
pull_request:
@@ -22,39 +22,32 @@ jobs:
2222
steps:
2323
- name: Lint commits, branches, and pull requests
2424
uses: aschbacd/[email protected]
25-
with:
26-
commit-message-body-max-length: 72
27-
commit-message-subject-max-length: 50
28-
prohibit-unknown-commit-authors: true
29-
prohibit-unknown-commit-committers: true
30-
re-commit-message-subject: ^[A-Z].*((?!\.).)$
31-
re-pull-request-title: ^[A-Z].*((?!\.).)$
3225
```
3326
3427
## Customization
3528
3629
The following input keys can be used in your GitHub Actions workflow (shown above).
3730
38-
| Key | Description | Default | Recommended |
39-
| ---------------------------------- | ------------------------------------------------------------ | ----------------------- | ----------------------- |
40-
| commit-message-body-max-length | Max. characters for line in commit message body | -1 (disabled) | 72 |
41-
| commit-message-body-min-length | Min. characters for line in commit message body | -1 (disabled) | -1 (disabled) |
42-
| commit-message-subject-max-length | Max. characters for commit message subject | -1 (disabled) | 50 |
43-
| commit-message-subject-min-length | Min. characters for commit message subject | -1 (disabled) | -1 (disabled) |
44-
| github-token | Token used to authenticate against GitHub api | `${{ github.token }}` | `${{ github.token }}` |
45-
| prohibit-blank-lines-cm-body | Commit message body cannot include blank lines | `false` | `false` |
46-
| prohibit-unknown-commit-authors | Commit author must be GitHub user | `false` | `true` |
47-
| prohibit-unknown-commit-committers | Commit committer must be GitHub user | `false` | `true` |
48-
| prohibit-unsigned-commits | Commits without a valid signature are invalid | `false` | `false` |
49-
| re-branch-name | Regex used to check branch name | `.*` | `.*` |
50-
| re-commit-author-email | Regex used to check commit author email | `.*` | `.*` |
51-
| re-commit-author-name | Regex used to check commit author name | `.*` | `.*` |
52-
| re-commit-committer-email | Regex used to check commit committer email | `.*` | `.*` |
53-
| re-commit-committer-name | Regex used to check commit committer name | `.*` | `.*` |
54-
| re-commit-message-body | Regex used to check commit message body (DotAll) | `.*` | `.*` |
55-
| re-commit-message-split | Regex used to split commit message subject and body (DotAll) | `([^\n]*)(?:\n\n(.*))?` | `([^\n]*)(?:\n\n(.*))?` |
56-
| re-commit-message-subject | Regex used to check commit message subject | `.*` | `^[A-Z].*((?!\.).)$` |
57-
| re-pull-request-title | Regex used to check pull request title | `.*` | `^[A-Z].*((?!\.).)$` |
31+
| Key | Description | Default |
32+
| ---------------------------------- | ------------------------------------------------------------ | ----------------------- |
33+
| commit-message-body-max-length | Max. characters for line in commit message body | 72 |
34+
| commit-message-body-min-length | Min. characters for line in commit message body | -1 (disabled) |
35+
| commit-message-subject-max-length | Max. characters for commit message subject | 50 |
36+
| commit-message-subject-min-length | Min. characters for commit message subject | -1 (disabled) |
37+
| github-token | Token used to authenticate against GitHub api | `${{ github.token }}` |
38+
| prohibit-blank-lines-cm-body | Commit message body cannot include blank lines | `false` |
39+
| prohibit-unknown-commit-authors | Commit author must be GitHub user | `true` |
40+
| prohibit-unknown-commit-committers | Commit committer must be GitHub user | `true` |
41+
| prohibit-unsigned-commits | Commits without a valid signature are invalid | `false` |
42+
| re-branch-name | Regex used to check branch name | `.*` |
43+
| re-commit-author-email | Regex used to check commit author email | `.*` |
44+
| re-commit-author-name | Regex used to check commit author name | `.*` |
45+
| re-commit-committer-email | Regex used to check commit committer email | `.*` |
46+
| re-commit-committer-name | Regex used to check commit committer name | `.*` |
47+
| re-commit-message-body | Regex used to check commit message body (DotAll) | `.*` |
48+
| re-commit-message-split | Regex used to split commit message subject and body (DotAll) | `([^\n]*)(?:\n\n(.*))?` |
49+
| re-commit-message-subject | Regex used to check commit message subject | `^[A-Z].*((?!\\.).)$` |
50+
| re-pull-request-title | Regex used to check pull request title | `^[A-Z].*((?!\\.).)$` |
5851

5952
## Resources
6053

action.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ inputs:
77
commit-message-body-max-length:
88
description: "Max. length of commit message body"
99
required: false
10-
default: -1
10+
default: 72
1111
commit-message-body-min-length:
1212
description: "Min. length of commit message body"
1313
required: false
1414
default: -1
1515
commit-message-subject-max-length:
1616
description: "Max. length of commit message subject"
1717
required: false
18-
default: -1
18+
default: 50
1919
commit-message-subject-min-length:
2020
description: "Min. length of commit message subject"
2121
required: false
@@ -31,11 +31,11 @@ inputs:
3131
prohibit-unknown-commit-authors:
3232
description: "Prohibit commit authors that are not known to GitHub"
3333
required: false
34-
default: false
34+
default: true
3535
prohibit-unknown-commit-committers:
3636
description: "Prohibit commit committers that are not known to GitHub"
3737
required: false
38-
default: false
38+
default: true
3939
prohibit-unsigned-commits:
4040
description: "Prohibit commits without a valid signature"
4141
required: false
@@ -71,11 +71,11 @@ inputs:
7171
re-commit-message-subject:
7272
description: "Regular expression to check commit message subject"
7373
required: false
74-
default: ".*"
74+
default: "^[A-Z].*((?!\\.).)$"
7575
re-pull-request-title:
7676
description: "Regular expression to check pull request title"
7777
required: false
78-
default: ".*"
78+
default: "^[A-Z].*((?!\\.).)$"
7979
runs:
8080
using: "node12"
8181
main: "index.js"

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ async function run() {
1313
const octokit = github.getOctokit(githubToken)
1414

1515
// Get data
16-
const { data: pullRequest } = await octokit.pulls.get({
16+
const { data: pullRequest } = await octokit.rest.pulls.get({
1717
owner: github.context.payload.repository.owner.login,
1818
repo: github.context.payload.repository.name,
1919
pull_number: github.context.payload.pull_request.number
2020
})
21-
const { data: commits } = await octokit.pulls.listCommits({
21+
const { data: commits } = await octokit.rest.pulls.listCommits({
2222
owner: github.context.payload.repository.owner.login,
2323
repo: github.context.payload.repository.name,
2424
pull_number: github.context.payload.pull_request.number

0 commit comments

Comments
 (0)