Skip to content

Commit

Permalink
Merge pull request #12 from flagbit/develop
Browse files Browse the repository at this point in the history
feat: Add issuePrefix-pattern that is matching our JIRA issues
  • Loading branch information
mralexandernickel committed Jul 6, 2021
2 parents 7c81f7c + 8b3bf56 commit 4c48a61
Show file tree
Hide file tree
Showing 6 changed files with 1,045 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
with:
fetch-depth: 0
- run: |
yarn global add @commitlint/cli @commitlint/config-conventional
yarn add @commitlint/cli @commitlint/config-conventional
echo "$(yarn global bin)" >> $GITHUB_PATH
- run: make lint
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ GITHUB_BASE_REF ?= master

.PHONY: lint
lint:
commitlint -g commitlint.config.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF))
node_modules/.bin/commitlint -g commitlint.config.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF))
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# Config Commitlint

Commitlint configuration used at flagbit
This is the configuration to lint our commitmessages at flagbit.
The basic format is simply using [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0/),
this config is only setting some more precise specifications.

This config is used by a tool named [commitlint](https://commitlint.js.org/#/),
that comes pretty handy to have a clean, readable git-history.

Conventionalcommits in general are giving us 3 important benefits:

1. our git history is clean, readable and informative
2. we can use automatic-semantic-versioning in our projects, the version to
set is then generated out of the commitmessages. (type and breaking-change)
3. we can generate automated CHANGELOG files in our repositories. These are then
also generated out of the commitmessages. (type and scope)

## How should a good COMMTIMSG look?

```
fix: Don't use GITHUB_TOKEN for release-please
Because events generated by a GITHUB_TOKEN will not trigger
other workflows.
References: FBTLOPS-159
```

## How can I use this in my project?

Expand All @@ -12,7 +36,7 @@ module.exports = {
extends: ["@flagbit/config-commitlint"],
parserPreset: {
parserOpts: {
issuePrefixes: ["FBTLOPS-"],
issuePrefixes: ["\\s[\\w\\d]{1,10}-"],
},
},
};
Expand Down Expand Up @@ -51,3 +75,22 @@ jobs:
echo "$(yarn global bin)" >> $GITHUB_PATH
- run: make lint
```

## How can I use this locally?

The package holding our config is published to default npm-registry. Because
most of us have set in their `.npmrc` to use our private registry for the
namespace `@flagbit`, it is necessary to tell yarn/npm which registry to use.
You can do like this:

```bash
yarn global add @commitlint/cli @flagbit/config-commitlint --registry https://registry.npmjs.org
```

## How can I get automated SemVer?

coming soon

## How can I get autoamted CHANGELOG?

coming soon
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
extends: ["./index.js"],
parserPreset: {
parserOpts: {
issuePrefixes: ["FBTLOPS-"],
issuePrefixes: ["\\s[\\w\\d]{1,10}-"],
},
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.0.1"
}
}
Loading

0 comments on commit 4c48a61

Please sign in to comment.