5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 08:06:54 +00:00
Lints Pull Request commits with commitlint
Find a file
Wagner Santos 6e0fcb1270 fix: don't fail on warnings
This follows the commitlint CLI behavior, which exits with success when there are only warnings.
This behavior can be changed by passing 'true' to the parameter `failOnWarnings`.
2020-02-01 16:32:55 -03:00
.github/workflows docs: update usage to explain how to use it with actions/checkout@v2 2020-01-05 06:55:27 -03:00
fixtures test: show coverage in CI tests 2019-12-09 20:29:48 -03:00
.commitlintrc.yml test: add second commitlint check using yml file instead of js 2019-10-08 13:19:58 -03:00
.dockerignore test: add tests for the action 2019-12-09 20:12:53 -03:00
.gitignore Initial commit 2019-10-01 18:29:56 -03:00
.prettierrc feat: add commitlint action 2019-10-04 00:17:29 -03:00
action.js fix: don't fail on warnings 2020-02-01 16:32:55 -03:00
action.test.js fix: don't fail on warnings 2020-02-01 16:32:55 -03:00
action.yml fix: don't fail on warnings 2020-02-01 16:32:55 -03:00
CHANGELOG.md chore(release): publish 2020-01-13 12:19:53 -03:00
commitlint.config.js chore: add commitlint config file 2019-10-04 00:18:00 -03:00
Dockerfile fix: revert action to use debian image 2019-10-04 00:47:40 -03:00
entrypoint.sh feat: add commitlint action 2019-10-04 00:17:29 -03:00
jest.config.js test: add tests for the action 2019-12-09 20:12:53 -03:00
LICENSE Initial commit 2019-10-01 18:29:56 -03:00
package-lock.json chore(release): publish 2020-01-13 12:19:53 -03:00
package.json chore(release): publish 2020-01-13 12:19:53 -03:00
README.md fix: don't fail on warnings 2020-02-01 16:32:55 -03:00
run.js test: add tests for the action 2019-12-09 20:12:53 -03:00
testUtils.js test: add tests for the action 2019-12-09 20:12:53 -03:00

Commitlint Github Action

Lints Pull Request commits with commitlint

Usage

Create a github workflow in the .github folder, e.g. .github/workflows/commitlint.yml:

name: Commitlint
on: [pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: wagoid/commitlint-github-action@v1

Alternatively, you can run on other event types such as on: [push]. In that case the action will lint the push event's commit(s) instead of linting commits from a pull request. You can also combine push and pull_request together in the same workflow.

Note: It's necessary that you specify the fetch-depth argument to actions/checkout@v2 step. By default they fetch only latest commit of the branch, but we need more commits since we validate a range of commit messages.

Inputs

configFile

The path to your commitlint config file.

Default: commitlint.config.js

firstParent

When set to true, we follow only the first parent commit when seeing a merge commit.

This helps to ignore errors in commits that were already present in your default branch (e.g. master) before adding conventional commit checks. More info in git-log docs.

Default: true

failOnWarnings

Whether you want to fail on warnings or not.

Default: false

About extends in your config file

This is a Docker action, and was made like this so that you can run it with minimum setup, regardless of your repo's environment. It comes packed with the most famous shared configurations that you can use in your commitlint config's extends field:

If you have a custom shared config that lies in a private registry, let us know! We will be happy to cover this case if necessary.