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

https://github.com/adityaa30/check-commit

Github Action to check if the commit follows proper syntax ๐Ÿ˜‰
https://github.com/adityaa30/check-commit

commit-conventions github-actions hacktoberfest typescript

Last synced: 3 days ago
JSON representation

Github Action to check if the commit follows proper syntax ๐Ÿ˜‰

Awesome Lists containing this project

README

          


GitHub Actions status

# Check Commit Message

Action to check if the commit follows proper guidelines as specified [here](http://karma-runner.github.io/latest/dev/git-commit-msg.html)

## Usage

Create a workflow `.yml` file in your repositories `.github/workflows` directory
(eg. `.github/workflows/check-commit.yml`). In your workflow you first need to checkout
your repository then use this [action](https://github.com/adityaa30/check-commit).

Refer to the example below,

```yaml
name: Check Commit Message

on: [pull_request, push]

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout ๐Ÿ›Ž๏ธ
uses: actions/checkout@v2

- name: Check commit ๐Ÿงช
uses: adityaa30/check-commit@master
```

## Input Parameters

- `compulsory-scope`
- Either 'true' or 'false'
- Defaults to 'false'
- If true, scope field becomes compulsory for each commit (refer [here](http://karma-runner.github.io/latest/dev/git-commit-msg.html))

- `max-header-length`
- Should be a valid non-zero positive integer
- Defaults to 50
- Raises an error if length of commit header is more than specified

## Project Installation

**[Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)** the repository

```bash
# Clone the forked repository
git clone https://github.com//check-commit.git

# Enter project directory
cd check-commit

# Install dependencies
npm install

# Build the project
npm run build
```

### NOTE

- Before pushing any changes, please build the project to update the `dist/index.js` in order to reflect your changes in github
- To test the project in your local use [act](https://github.com/nektos/act)

## TODO

- [x] Get the commit message
- [x] Implement rules based on syntax defined [here](http://karma-runner.github.io/latest/dev/git-commit-msg.html)
- [x] Helper functions to check commit message based on rules
- [x] Add input parameter `compulsory-scope`
- [x] Add input parameter `max-header-length`
- [ ] Add a **[CLI](https://en.wikipedia.org/wiki/Command-line_interface)**
- [ ] Add custom **[input parameters](https://help.github.com/en/actions/building-actions/metadata-syntax-for-github-actions#inputs)**