Tired of messy PR titles? Want to enforce a consistent style across your team? MoodLint is here to rescue your git workflow! With MoodLint, say goodbye to irrelevant and unprofessional PR titles. Our tool validates the mood, prefix, and overall structure of your PR titles, ensuring they're up to the mark.
Let MoodLint bring peace and order to your PR chaos! Give it a star if you find it useful.
- Validates PR title prefix for predefined types like
feat
,fix
,chore
, and more! - Checks if your PR title and description are phrased in the imperative mood.
- Exits with a non-zero code for any validation failures, making it perfect for CI/CD pipelines.
- Comprehensive reporting and examples to guide you in case of an error.
To install MoodLint as a GitHub Action, add the following YAML configuration to your repository under .github/workflows/moodlint.yml
.
name: MoodLint PR Title Check
on:
pull_request:
types: [opened, synchronize, reopened, edited, ready_for_review]
jobs:
check-title:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run MoodLint
uses: your-username/[email protected]
Replace your-username
with your GitHub username and adjust the version tag as needed.
Once the GitHub Action is set up, it will automatically run whenever a Pull Request is opened or updated. If the title does not comply with the imperative mood or valid prefixes, the Action will fail and log an error message.
By default, MoodLint validates PR titles against the following allowed prefixes:
feat
fix
chore
refactor
regfix
If you'd like to customize these prefixes, you can modify the allowedPrefixes
variable inside the src/validator/prefix_validator.go
file.
You can also run MoodLint as a Docker container. Here's how to do it:
-
Build the Docker image:
docker build -t moodlint .
-
Run the Docker container:
docker run moodlint "Your PR Title Here"
This will execute MoodLint and check the given PR title.
To work on the MoodLint project:
- Clone the repository
git clone https://github.com/your-username/MoodLint.git
- Navigate to the project directory
cd MoodLint
- Install dependencies
go mod tidy
Run tests, if any:
go test ./...
Build the project:
go build
If you'd like to contribute, please fork the repository and create a pull request, or simply open an issue for bugs and feature requests.
MIT