Skip to content

Commit f08b7f1

Browse files
fix: added commitlint [macata #31] (#32)
1 parent b904e2e commit f08b7f1

File tree

9 files changed

+97
-6
lines changed

9 files changed

+97
-6
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Java CI
1+
name: Java Build & Test
22

33
on: [push]
44

.github/workflows/codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: CodeQL Analysis
2+
13
on:
24
push:
35
branches: [ master, develop ]

.github/workflows/commitlint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run Commitlint on PR's commits
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
run-commitlint-on-pr:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: '16'
18+
19+
- name: Install Commitlint
20+
run: npm install --save-dev @commitlint/{cli,config-conventional}
21+
22+
- name: Validate all commits from PR using Commitlint
23+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

.github/workflows/prnamelint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run Commitlint on PR's title
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened, synchronize]
6+
7+
8+
jobs:
9+
run-commitlint-on-pr:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '16'
20+
21+
- name: Install Commitlint
22+
run: npm install --save-dev @commitlint/{cli,config-conventional}
23+
24+
- name: Validate PR title using Commitlint
25+
run: echo ${{ github.event.pull_request.title }} | npx commitlint

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,10 @@ backups
4343
.macatalauncher
4444
trashed
4545
userdir
46-
mods
46+
mods
47+
48+
### Husky / CommitLint ###
49+
node_modules
50+
package-lock.json
51+
package.json
52+
yarn.lock

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no-install commitlint --edit "$1"

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ MaCata requires Java 11 to run.
2929

3030
Just put the `macatalauncher.jar` in some folder of your choice and double click!
3131

32+
## Build
33+
34+
Just run `mvn package` and a `macatalauncher-x.x.x.jar` binary will be built in the `target` directory.
35+
36+
## Development
37+
38+
Before making changes to the codebase, installing `husky` is encouraged: https://typicode.github.io/husky/get-started.html
39+
40+
While not mandatory, if commits are not properly formatted, they may get rejected by GitHub's `commitlint` action.
41+
3242
## Features
3343

3444
### Current
@@ -55,10 +65,6 @@ Just put the `macatalauncher.jar` in some folder of your choice and double click
5565
- I want to focus mainly on macOS since there are already some excellent launchers for Windows and Linux already.
5666
- Having said that, given the current launcher architecture, I would like to think it wouldn't be terribly hard to support Linux and/or Windows. Just a couple of changes to the [launcher class](src/main/java/com/dazednconfused/catalauncher/launcher/CDDALauncherManager.java) maybe? PRs welcome!
5767

58-
## Build
59-
60-
Just run `mvn package` and a `macatalauncher-x.x.x.jar` binary will be built in the `target` directory.
61-
6268
## FAQ
6369

6470
### Why Yet Another Launcher?

commitlint.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
parserPreset: {
4+
parserOpts: {
5+
headerPattern: /^(\w+)(?:\((\w+)\))?: (.*) \[macata #(\d+)\]$/,
6+
headerCorrespondence: ['type', 'scope', 'subject', 'issue'],
7+
},
8+
},
9+
rules: {
10+
'type-enum': [2, 'always', [
11+
'build',
12+
'chore',
13+
'ci',
14+
'docs',
15+
'feat',
16+
'fix',
17+
'perf',
18+
'refactor',
19+
'revert',
20+
'style',
21+
'test',
22+
'wip'
23+
] ],
24+
'header-max-length': [2, 'always', 100],
25+
'references-empty': [2, 'never']
26+
},
27+
};

0 commit comments

Comments
 (0)