Skip to content

Commit eb2c974

Browse files
Merge pull request #73 from BitGo/WP-5314/apply-conventional-commit
ci: enable commit lint for future commits
2 parents 64f65f5 + 3a83ec4 commit eb2c974

File tree

5 files changed

+2297
-1794
lines changed

5 files changed

+2297
-1794
lines changed

.commitlintrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"],
3+
"rules": {
4+
"footer-max-line-length": [0, "always"],
5+
"header-max-length": [2, "always", 72],
6+
"references-empty": [1, "never"],
7+
"subject-case": [0],
8+
"scope-enum": [2, "always", ["mbe", "ebe", "docker"]],
9+
"scope-empty": [0, "never"]
10+
},
11+
"parserPreset": {
12+
"parserOpts": {
13+
"issuePrefixes": ["BTC-", "COIN-", "WP-"]
14+
}
15+
}
16+
}

.github/workflows/build-and-test.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,38 @@ on:
99
default: '22.1.0'
1010

1111
jobs:
12+
commit-lint:
13+
name: Commit Lint
14+
runs-on: ubuntu-latest
15+
if: github.event_name == 'pull_request'
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ inputs.node-version }}
26+
cache: 'yarn'
27+
28+
- name: Cache dependencies
29+
uses: actions/cache@v3
30+
id: node-modules-cache
31+
with:
32+
path: '**/node_modules'
33+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-modules-
36+
37+
- name: Install dependencies
38+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
39+
run: yarn install
40+
41+
- name: Validate PR commits with commitlint
42+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
43+
1244
build:
1345
name: Build
1446
runs-on: ubuntu-latest
@@ -22,7 +54,17 @@ jobs:
2254
node-version: ${{ inputs.node-version }}
2355
cache: 'yarn'
2456

57+
- name: Cache dependencies
58+
uses: actions/cache@v3
59+
id: node-modules-cache
60+
with:
61+
path: '**/node_modules'
62+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
63+
restore-keys: |
64+
${{ runner.os }}-modules-
65+
2566
- name: Install dependencies
67+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
2668
run: yarn install
2769

2870
- name: Build
@@ -41,7 +83,17 @@ jobs:
4183
node-version: ${{ inputs.node-version }}
4284
cache: 'yarn'
4385

86+
- name: Cache dependencies
87+
uses: actions/cache@v3
88+
id: node-modules-cache
89+
with:
90+
path: '**/node_modules'
91+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
92+
restore-keys: |
93+
${{ runner.os }}-modules-
94+
4495
- name: Install dependencies
96+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
4597
run: yarn install
4698

4799
- name: Lint
@@ -60,7 +112,17 @@ jobs:
60112
node-version: ${{ inputs.node-version }}
61113
cache: 'yarn'
62114

115+
- name: Cache dependencies
116+
uses: actions/cache@v3
117+
id: node-modules-cache
118+
with:
119+
path: '**/node_modules'
120+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
121+
restore-keys: |
122+
${{ runner.os }}-modules-
123+
63124
- name: Install dependencies
125+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
64126
run: yarn install
65127

66128
- name: Generate test SSL certificates

git_commit_template.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# ^ Subject Line
3+
# Capitalize, do not end with a period, use the imperative mood
4+
# Limit the subject line to no more than 72 characters: end here --> |
5+
6+
7+
# ^ Body
8+
# Separate subject from body with a blank line, wrap at 72 characters|
9+
# Use the body to explain what and why
10+
11+
Ticket: PROJECT-NUMBER
12+
# ^ Metadata: keyword: <value>
13+
14+
########################################################################
15+
# #
16+
# BitGo Commit Message Standard #
17+
# (info inlined above as well) #
18+
# #
19+
# #
20+
########################################################################
21+
# Commit Message SHALL
22+
# …limit the subject line to no more than 72 characters
23+
# …capitalize the subject line
24+
# …not end the subject line with a period
25+
# …use the imperative mood in the subject line
26+
# …separate subject from body with a blank line
27+
# …wrap the body at 72 characters
28+
#
29+
# Commit Message SHOULD use the body to explain what and why vs. how
30+
#
31+
# Commit Message metadata SHALL be at the bottom of the commit message
32+
# Commit Message metadata MUST follow format “keyword: <value>”
33+
# Commit Message metadata SHOULD contain a ticket reference in the format “Ticket: PROJECT-NUMBER”
34+
#

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@
2525
"@api-ts/response": "^2.1.0",
2626
"@api-ts/superagent-wrapper": "^1.3.3",
2727
"@api-ts/typed-express-router": "^1.1.13",
28-
"@bitgo/sdk-core": "^35.3.0",
2928
"@bitgo-beta/sdk-lib-mpc": "8.2.1-alpha.291",
29+
"@bitgo/abstract-utxo": "^9.21.4",
3030
"@bitgo/sdk-coin-ada": "^4.11.5",
3131
"@bitgo/sdk-coin-dot": "^4.3.5",
32-
"@bitgo/sdk-coin-sui": "^5.15.5",
3332
"@bitgo/sdk-coin-near": "^2.7.0",
3433
"@bitgo/sdk-coin-sol": "^4.12.5",
35-
"bitgo": "^48.1.0",
36-
"@bitgo/abstract-utxo": "^9.21.4",
34+
"@bitgo/sdk-coin-sui": "^5.15.5",
35+
"@bitgo/sdk-core": "^35.3.0",
3736
"@bitgo/statics": "^54.6.0",
37+
"@commitlint/config-conventional": "^19.8.1",
38+
"bitgo": "^48.1.0",
3839
"body-parser": "^1.20.3",
3940
"connect-timeout": "^1.9.0",
4041
"debug": "^3.1.0",
@@ -54,6 +55,7 @@
5455
},
5556
"devDependencies": {
5657
"@api-ts/openapi-generator": "^5.7.0",
58+
"@commitlint/cli": "^19.8.1",
5759
"@types/body-parser": "^1.17.0",
5860
"@types/connect-timeout": "^1.9.0",
5961
"@types/debug": "^4.1.12",

0 commit comments

Comments
 (0)