An open API service indexing awesome lists of open source software.

https://github.com/deepakputhraya/action-pr-title

Github action to enforce Pull Request title conventions
https://github.com/deepakputhraya/action-pr-title

github-actions hacktoberfest pull-request pull-requests pullrequest pullrequests

Last synced: 21 days ago
JSON representation

Github action to enforce Pull Request title conventions

Awesome Lists containing this project

README

        

# Branch naming rules
GitHub Actions status

Github action to enforce Pull Request title conventions

## Usage

See [action.yml](./action.yml)

```yaml
steps:
- uses: deepakputhraya/action-pr-title@master
with:
regex: '([a-z])+\/([a-z])+' # Regex the title should match.
allowed_prefixes: 'feature,fix,JIRA' # title should start with the given prefix
disallowed_prefixes: 'feat/,hotfix' # title should not start with the given prefix
prefix_case_sensitive: false # title prefix are case insensitive
min_length: 5 # Min length of the title
max_length: 20 # Max length of the title
verbal_description: 'Two words with a slash (/) between' # Verbal description of the regex rule
github_token: ${{ github.token }} # Default: ${{ github.token }}
```

### Note:
Ensure to add `types` to the Pull requests webhook event as by default workflows are triggered only
for `opened`, `synchronize`, or `reopened` pull request events. Read more about
it [here](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#pull_request).
```yaml
on:
pull_request:
types: [opened, edited, synchronize, reopened]
```
or
[here](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#pull_request_target).
```yaml
on:
pull_request_target:
types: [opened, edited, synchronize, reopened]
```

Triggering the action on anything other than `pull_request` or `pull_request_target` will cause a failure.

## Permissions

In case the action fails with the following error:

```
Event name: pull_request
Error: Resource not accessible by integration
```

You can fix this, by adding the following to your workflow:

```yaml
permissions:
pull-requests: read
```

## License
The scripts and documentation in this project are released under the [MIT License](./LICENSE)