Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seferov/pr-lint-action
:octocat: PR lint for GitHub Actions
https://github.com/seferov/pr-lint-action
actions github-actions pull-request
Last synced: about 2 months ago
JSON representation
:octocat: PR lint for GitHub Actions
- Host: GitHub
- URL: https://github.com/seferov/pr-lint-action
- Owner: seferov
- License: mpl-2.0
- Created: 2019-08-21T12:12:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-12T02:45:38.000Z (over 1 year ago)
- Last Synced: 2024-10-01T05:02:46.269Z (3 months ago)
- Topics: actions, github-actions, pull-request
- Language: TypeScript
- Homepage:
- Size: 82 KB
- Stars: 119
- Watchers: 3
- Forks: 24
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Lint a PR
- fucking-awesome-actions - Lint a PR
- awesome-workflows - Lint a PR
README
# Pull Request Lint
It is a linter of pull requests for [GitHub Actions](https://github.com/features/actions).
## Why?
To enforce pull request titles in the same format will be useful like generating standard changelog messages.
Besides it can be used to parse titles and link with issue tracking systems such as JIRA.## Example:
```yaml
name: PR linton:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']jobs:
pr-lint:
runs-on: ubuntu-latest
steps:
- uses: seferov/pr-lint-action@master
with:
title-regex: '^\[PROJECT-\d*\](\ )'
title-regex-flags: 'g' # optional
error-message: 'Add Jira ID to your title' # optional
```In this example, for every pull request the title is expected to match `^\[PROJECT-\d*\]\ ` regex with a global flag `g`. For instance, `[PROJECT-123] lorem ipsum` or `[PROJECT-2345] dolor sit amet` are valid titles for this example. You can customize the title regex for your needs. The regex flags configuration is optional.
## Auto-close
It can be configured to close pull request automatically if the title does not match the pattern provided. To do so, `github-token` and `auto-close-message` options must be configured.
In the message, `%pattern%` is replaced with the actual the pattern provided. Here is an [example pull request](https://github.com/seferov/pr-lint-action/pull/25).Config:
```diff
name: PR linton:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']jobs:
pr-lint:
runs-on: ubuntu-latest
steps:
- uses: seferov/pr-lint-action@master
with:
title-regex: '^\[PROJECT-\d*\](\ )'
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ auto-close-message: 'Closing this pull request since the title does not match %pattern% pattern. Please fix the title and re-open the pull request.'
```