Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vijaykramesh/pr-lint-action
A GitHub Action that verifies your pull request contains a reference to a Jira ticket.
https://github.com/vijaykramesh/pr-lint-action
Last synced: 3 months ago
JSON representation
A GitHub Action that verifies your pull request contains a reference to a Jira ticket.
- Host: GitHub
- URL: https://github.com/vijaykramesh/pr-lint-action
- Owner: vijaykramesh
- License: mit
- Created: 2019-07-19T19:01:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-05T18:20:59.000Z (6 months ago)
- Last Synced: 2024-08-01T16:35:45.480Z (6 months ago)
- Language: JavaScript
- Size: 604 KB
- Stars: 73
- Watchers: 3
- Forks: 22
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Verify That PRs Contain a Ticket Reference
- fucking-awesome-actions - Verify That PRs Contain a Ticket Reference
- awesome-workflows - Verify That PRs Contain a Ticket Reference
README
# pr-lint-action
A GitHub Action that verifies your pull request contains a reference to a ticket. You can use this to (optionally) check:
* The PR title contains `[PROJ-1234]`
* The branch name contains `PROJ-1234` or `PROJ_1234`
* Each commit contains `[PROJ-1234]`## Usage
Add `.github/workflows/main.yml` with the following:
```
name: PR Lint
on: [pull_request]
jobs:
pr_lint:
runs-on: ubuntu-latest
steps:
- uses: vijaykramesh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}```
See [pr-lint-action-example-repo](https://github.com/vijaykramesh/pr-lint-action-example-repo) for an example of usage.
## Configuration
Configure by creating a `.github/pr-lint.yml` file:
For example:
```yml
projects: ['PROJ', 'ABC']
check_title: true
check_branch: true
check_commits: true
ignore_case: true
require_brackets: true
```## Local Development
Run `yarn install` to install any dependencies needed.
## Testing
Run `yarn test` to test:
```
PASS ./index.test.js
pr-lint-action
✓ fails if check_title is true and title does not match (15 ms)
✓ fails if bad title and branch (14 ms)
✓ passes if check_title is false and title does not match (6 ms)
✓ passes if check_title is true and title matches (5 ms)
✓ fails if check_branch is true and branch does not match (5 ms)
✓ passes if check_branch is false and branch does not match (5 ms)
✓ passes if check_branch is true and branch matches (5 ms)
✓ passes if check_commits is true and all commits match (7 ms)
✓ fails if check_commits is true and some commits do not match (9 ms)
✓ passes if check_commits is false and all commits match (4 ms)
✓ passes if check_commits is false and some commits do not match (5 ms)
✓ fails if check_branch and check_title is true and title does not match (7 ms)
✓ fails if check_branch and check_title is true and title does not match (8 ms)
✓ passes if check_branch and check_title is true and both match (10 ms)
✓ passes if ignore_case and lower case title/branch (6 ms)
✓ passes if ignore_case and lower case commits (7 ms)
✓ fails if not ignore_case and lower case title/branch (4 ms)
✓ passes if require_brakcets is false and title matches without brackets (5 ms)
✓ fails if require_brackets is true or default and title matches without brackets (4 ms)
```## Lint
Run `yarn lint` to run ESLint. Run `yarn lint --fix` to fix any issues that it can.
## Contributing
If you have other things worth automatically checking for in your PRs, please submit a pull request.