https://github.com/welpo/git-sumi-action
Lints Pull Request titles with git-sumi
https://github.com/welpo/git-sumi-action
commit-messages conventional-commits conventions github-actions lint pull-requests
Last synced: 30 days ago
JSON representation
Lints Pull Request titles with git-sumi
- Host: GitHub
- URL: https://github.com/welpo/git-sumi-action
- Owner: welpo
- License: apache-2.0
- Created: 2024-02-04T14:52:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-27T02:30:00.000Z (over 1 year ago)
- Last Synced: 2024-10-11T01:49:34.430Z (over 1 year ago)
- Topics: commit-messages, conventional-commits, conventions, github-actions, lint, pull-requests
- Language: Shell
- Homepage: https://sumi.rs
- Size: 71.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 🏮 Run git-sumi Action
This GitHub action runs [git-**sumi**](https://sumi.rs) to validate Pull Request titles or lint commit ranges using the `sumi.toml` configuration set up in the root of your repository.
## Inputs
| Input | Description | Default |
|-------|-------------|---------|
| `mode` | Lint mode: `pr-title` or `commits` | `pr-title` |
| `from` | Start of revision range (exclusive). Only for `commits` mode. | `origin/` |
| `to` | End of revision range (inclusive). Only for `commits` mode. | `HEAD` |
## Usage
Add a `sumi.toml` file to the root of your repository, enabling the rules you want to use (see the [configuration](https://sumi.rs/docs/configuration/) and [rules](https://sumi.rs/docs/rules/) documentation).
### Linting PR titles
Create the workflow file `.github/workflows/git-sumi.yaml`:
```yaml
name: Lint pull request title
on:
pull_request:
types:
- opened
- edited
- synchronize
- ready_for_review
permissions:
pull-requests: read
jobs:
main:
name: Run git-sumi
runs-on: ubuntu-latest
steps:
- uses: welpo/git-sumi-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
### Linting commits
To lint all commits in a pull request, set `mode: commits`:
```yaml
name: Lint commits
on:
pull_request:
types:
- opened
- edited
- synchronize
- ready_for_review
permissions:
pull-requests: read
jobs:
main:
name: Run git-sumi
runs-on: ubuntu-latest
steps:
- uses: welpo/git-sumi-action@main
with:
mode: commits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
By default, this lints all commits between `origin/` and `HEAD`. You can override the range:
```yaml
- uses: welpo/git-sumi-action@main
with:
mode: commits
from: origin/develop
to: HEAD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## Questions?
Don't hesitate to reach out via the [issue tracker](https://github.com/welpo/git-sumi-action/issues), [discussions](https://github.com/welpo/git-sumi-action/discussions), or [email](mailto:osc@osc.garden?subject=[GitHub]%20git-sumi-action).
## License
This project is licensed under the terms of both the [MIT license](/LICENSE-MIT) and the [Apache License (Version 2.0)](/LICENSE-APACHE), at your option.