Skip to content

Commit

Permalink
ci: release
Browse files Browse the repository at this point in the history
  • Loading branch information
nradulaski-godaddy committed May 22, 2022
1 parent f8e3f2a commit ef56b86
Show file tree
Hide file tree
Showing 9 changed files with 9,888 additions and 31 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/pullforcer.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull request
name: CI
on:
pull_request_target:
types:
Expand All @@ -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,})$'
38 changes: 22 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions action.yml
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'
Loading

0 comments on commit ef56b86

Please sign in to comment.