Skip to content

Commit

Permalink
Merge pull request #166 from amelioro/conventional-commits
Browse files Browse the repository at this point in the history
build: lint commits on pr
  • Loading branch information
alextilot authored May 23, 2023
2 parents 1042b96 + f781b79 commit 4ca37e0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name: ci
on: pull_request

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
lint:
runs-on: ubuntu-latest
defaults:
Expand All @@ -17,3 +24,4 @@ jobs:
if: always() # get formatting errors even if there are errors above
- run: npm run lint
if: always() # get lint errors even if there are errors above

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This project uses commit hooks to automate some tasks, and these are managed via

#### Conventional commits

[Conventional commits](https://www.conventionalcommits.org/) is a standard format for commit messages, used to aid readability of commit history. This commit message format, with [these commit types](https://github.com/amelioro/ameliorate/blob/main/commitlint.config.js), is enforced in a commit hook via [commitlint](https://github.com/conventional-changelog/commitlint).
[Conventional commits](https://www.conventionalcommits.org/) is a standard format for commit messages, used to aid readability of commit history. The format is `<type>[optional scope]: <description>` and an example commit message looks like `feat(header): add link to feedback page`. This commit message format, with [these commit types](https://github.com/amelioro/ameliorate/blob/main/commitlint.config.js), is enforced in a commit hook and github action via [commitlint](https://github.com/conventional-changelog/commitlint).

#### Prettier

Expand Down
25 changes: 13 additions & 12 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
helpUrl:
"https://github.com/amelioro/ameliorate/blob/main/CONTRIBUTING.md#conventional-commits",
rules: {
"type-enum": [
2,
"always",
// custom types should have comments explaining them
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"build", // modifies the build process / pipeline for the application
"chore", // is a catch-all for any change that doesn't fit into another category
"ci", // modifies the continuous integration pipeline
"docs", // adds or improves documentation
"feat", // adds new functionality
"fix", // fixes a bug
"touchup", // small improvement, too small for "feat" or "refactor"
"perf",
"refactor",
"revert",
"style",
"test",
"perf", // improves performance without functionality changes
"refactor", // doesn't add functionality and doesn't fix a bug
"revert", // undoes a previous commit
"style", // does not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
"test", // updates testing
],
],
},
Expand Down

0 comments on commit 4ca37e0

Please sign in to comment.