diff --git a/.github/prclintrc.json b/.github/prcolinterrc.json similarity index 100% rename from .github/prclintrc.json rename to .github/prcolinterrc.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6decb9c..31d7a27 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Test the action locally - uses: ./ + uses: matmar10/pr-conventional-commit@1.1.0 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index f5e8585..54bb1ac 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,61 @@ -# pr-conventional-commit -Enforce conventional commits against multiple commits within a single PR +![Prcolinter](https://github.com/matmar10/prcolinter/blob/master/logo.png?raw=true "Percolinter PR Conventional Commit Linter") + +Easily lint _each_ commit for your PRs against the [Conventional Commit](https://www.conventionalcommits.org/) spec based on [configurable Linter rules](https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md). + +**Brew up a stronger commit history!** + +## Quick Start + +```yaml +name: Conventional Commit + +on: + pull_request: + branches: [ '*' ] + +jobs: + lint-commits: + steps: + - uses: actions/checkout@v2 + - uses: matmar10/prcolinter@1.2.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} +``` + +## Custom rules + +By default, it uses [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/index.js) rules. + +Add a JSON file under `.github/prcolinterrc.json` to define your customer rules: + +```json +{ + "rules": { + "body-max-line-length": [2, "always", 300], + } +} +``` + +-- or -- + +You can use or customize any of the [Commitlint rules listed here](https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md) + +You can also define custom rules inline: + +```yaml +name: Conventional Commit + +on: + pull_request: + branches: [ '*' ] + +jobs: + lint-commits: + steps: + - uses: actions/checkout@v2 + - uses: matmar10/prcolinter@1.2.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + # NOTE: the use of a string, not an object because github doesn't support objects as args + rules: '{"body-max-line-length": [2, "always", 300]}' +``` diff --git a/action.yml b/action.yml index b2a62a5..d1ec454 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: required: true config_path: description: Path to configuration file - default: './.github/prclintrc.json' + default: './.github/prcolinterrc.json' rules: description: 'Rule set for commit linter. For examples, see https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/index.js' diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..aa74653 Binary files /dev/null and b/logo.png differ diff --git a/package.json b/package.json index 2f2a960..87870eb 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "pr-conventional-commit", + "name": "prcolinter", "version": "1.1.0", "description": "", "main": "index.js", @@ -25,6 +25,7 @@ "@commitlint/lint": "^13.2.0" }, "release-it": { + "ci": true, "plugins": { "@release-it/conventional-changelog": { "infile": "CHANGELOG.md", @@ -85,8 +86,7 @@ "release": true }, "npm": { - "private": true, - "publish": false + "publish": true } } }