Skip to content

Commit

Permalink
feat: Add config, workflows, tools and README
Browse files Browse the repository at this point in the history
Release-As: 1.0.0

[FBTLOPS-159]
  • Loading branch information
mralexandernickel committed Mar 9, 2021
0 parents commit f4a073d
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows
Submodule workflows added at 0fd09e
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DEFAULT_GOAL := lint
GITHUB_BASE_REF ?= master

.PHONY: lint
lint:
commitlint -g index.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF))
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Config Commitlint

Commitlint configuration used at flagbit

## How can I use this in my project?

Create a new file named `commitlint.config.js` in your projects root directory,
including this content:

```javascript
module.exports = {
extends: ["@flagbit/config-commitlint"],
parserPreset: {
parserOpts: {
issuePrefixes: ["FBTLOPS-"],
},
},
};
```

...add (or extend an existing) Makefile to include a `lint` target:

```makefile
.DEFAULT_GOAL := lint
GITHUB_BASE_REF ?= master

.PHONY: lint
lint:
commitlint -g index.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF))
```

...and finally add a github-workflow to your project by placing a file named
`commitlint.yml` to the `.github/workflows/`-directory in your project. If this
directory is not existing, then you can simply create it. The `commitlint.yml`
needs to include this content:

```yml
name: commitlint
on: pull_request

jobs:
commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
yarn global add @commitlint/cli @flagbit/config-commitlint
echo "$(yarn global bin)" >> $GITHUB_PATH
- run: make lint
```
36 changes: 36 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-case': [2, 'always', 'sentence-case'],
'body-leading-blank': [2, 'always'],
'body-max-line-length': [2, 'always', 72],
'footer-leading-blank': [2, 'always'],
'footer-max-line-length': [2, 'always', 72],
'header-max-length': [2, 'always', 72],
'header-min-length': [2, 'always', 30],
'references-empty': [2, 'never'],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'always', 'sentence-case'],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
],
],
},
};
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@flagbit/config-commitlint",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@commitlint/config-conventional": "^12.0.1"
}
}
54 changes: 54 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@commitlint/config-conventional@^12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-12.0.1.tgz#7bf3bbf68bda967c5165135ebe8f2055decf1a83"
integrity sha512-1ZhB135lh47zVmf1orwcjxuKuam11fJIH/bdVxW9XiQv8XPwC6iIp19knfl8FcOT78AVBnes1z6EVxgUeP2/4Q==
dependencies:
conventional-changelog-conventionalcommits "^4.3.1"

array-ify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece"
integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=

compare-func@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3"
integrity sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==
dependencies:
array-ify "^1.0.0"
dot-prop "^5.1.0"

conventional-changelog-conventionalcommits@^4.3.1:
version "4.5.0"
resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.5.0.tgz#a02e0b06d11d342fdc0f00c91d78265ed0bc0a62"
integrity sha512-buge9xDvjjOxJlyxUnar/+6i/aVEVGA7EEh4OafBCXPlLUQPGbRUBhBUveWRxzvR8TEjhKEP4BdepnpG2FSZXw==
dependencies:
compare-func "^2.0.0"
lodash "^4.17.15"
q "^1.5.1"

dot-prop@^5.1.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88"
integrity sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==
dependencies:
is-obj "^2.0.0"

is-obj@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==

lodash@^4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

q@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=

0 comments on commit f4a073d

Please sign in to comment.