-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8e3f2a
commit ef56b86
Showing
9 changed files
with
9,888 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Pull request | ||
name: CI | ||
on: | ||
pull_request_target: | ||
types: | ||
|
@@ -8,9 +8,10 @@ on: | |
- synchronize | ||
|
||
jobs: | ||
lint: | ||
pr: | ||
name: Pullforcer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: radulle/[email protected] | ||
with: | ||
title-regexp: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{8,})$' | ||
pr-title-regexp: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{8,})$' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,12 @@ | |
|
||
Enforce title and body of your pull requests via regular expressions. | ||
|
||
## Usage | ||
|
||
Add `./github/workflows/ci.yml` to your `main` branch: | ||
|
||
```yml | ||
name: Pullforcer (Pull Request Enforcer) | ||
name: CI | ||
on: | ||
pull_request_target: | ||
types: | ||
|
@@ -13,34 +17,36 @@ on: | |
- synchronize | ||
|
||
jobs: | ||
lint: | ||
pr: | ||
name: Pullforcer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: radulle/[email protected] | ||
- uses: radulle/[email protected] | ||
# If you run locally copy action.yml and dist contents to .github/actions/pullforcer and replace previous line with: | ||
# - uses: actions/checkout@v3 | ||
# - uses: ./.github/actions/pullforcer | ||
with: | ||
title-regexp: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{8,})$' | ||
pr-title-regexp: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{4,})$' | ||
``` | ||
This title regexp would enforce all lowercase Conventional Commit with subject being at least 8 characters long. | ||
## Width | ||
### `pr-title-regexp` | ||
|
||
Regular expression. `^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{4,})$` would enforce all lowercase [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) with subject being at least 4 characters long. | ||
|
||
### `pr-body-regexp` | ||
|
||
Regular expression. `(\r\n.+){2}` would require body to be at least two lines long | ||
|
||
## Development | ||
|
||
```bash | ||
$ npm install | ||
$ npm run build && npm run package | ||
$ npm test | ||
``` | ||
|
||
## Publish to a distribution branch | ||
|
||
```bash | ||
$ npm run package | ||
$ git add dist | ||
$ git commit -a -m "prod dependencies" | ||
$ git push origin releases/v1 | ||
``` | ||
|
||
## Refferences | ||
## References | ||
- [action.yml](https://help.github.com/en/articles/metadata-syntax-for-github-actions) | ||
- [actions toolkit](https://github.com/actions/toolkit) | ||
- [ncc](https://github.com/zeit/ncc) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
name: 'Pullforcer' | ||
description: 'Enforce Pull Request Rules' | ||
author: 'Nikola Radulaski <[email protected]>' | ||
author: 'Nikola Radulaški <[email protected]>' | ||
branding: | ||
icon: 'git-pull-request' | ||
color: 'blue' | ||
inputs: | ||
titler-regexp: | ||
pr-title-regexp: | ||
required: false | ||
description: 'Regular expression used to validate PR title.' | ||
body-regexp: | ||
pr-body-regexp: | ||
required: false | ||
description: 'Regular expression used to validate PR body.' | ||
runs: | ||
using: 'node16' | ||
main: 'dist/index.js' | ||
main: './index.js' |
Oops, something went wrong.