@toptal/davinci-ci 1.13.4-alpha-fx-2225-create-an-eslint-rule-regarding-usage-fc-in-the-components.1335 → 1.13.4-alpha-fx-2196-improve-commit-validation-message.1335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/commands/danger.js +1 -1
- package/src/configs/danger/toptal/config.js +8 -2
- package/src/configs/danger/toptal/plugins/toptal-commits/index.js +10 -4
- package/src/configs/danger/toptal/plugins/toptal-pr-title/index.js +2 -2
- package/src/configs/jobs/pr-tests/Jenkinsfile +1 -1
- package/src/configs/jobs/publish-alpha-package/Jenkinsfile +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-ci",
|
|
3
|
-
"version": "1.13.4-alpha-fx-
|
|
3
|
+
"version": "1.13.4-alpha-fx-2196-improve-commit-validation-message.1335+fdbf7f9",
|
|
4
4
|
"description": "Continuos integrations tools for frontend projects",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@commitlint/cli": "^12.1.4",
|
|
34
34
|
"@commitlint/config-conventional": "^12.1.4",
|
|
35
|
-
"@toptal/davinci-cli-shared": "1.4.2-alpha-fx-
|
|
35
|
+
"@toptal/davinci-cli-shared": "1.4.2-alpha-fx-2196-improve-commit-validation-message.1335+fdbf7f9",
|
|
36
36
|
"danger": "^10.7.1",
|
|
37
37
|
"markdown-table": "^2.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "fdbf7f9105a7334e746c12f6381151d3be99b216"
|
|
40
40
|
}
|
package/src/commands/danger.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
const WHITELISTED_USERS = ['dependabot-preview[bot]', 'dependabot[bot]', 'toptal-devbot']
|
|
2
2
|
const VALID_PR_CODE_REGEX = /\[[A-Z]{1,4}-.*]\s/
|
|
3
|
-
|
|
3
|
+
// Valid commit titles:
|
|
4
|
+
// "Regular commit message"
|
|
5
|
+
// "Commit with sentence. But does not end with a full-stop"
|
|
6
|
+
// "[FOO-1234] Commit with prefix"
|
|
7
|
+
// "[FOO] Prefix numbers can be omitted"
|
|
8
|
+
// "[FOO][BAR] Prefixes can couple"
|
|
9
|
+
const VALID_COMMIT_TITLE_REGEX = /^((\[[A-Z]+(-\d+)?])+ )?[A-Z]\w[^\n]*[^.]$/
|
|
4
10
|
const MAX_COMMIT_LINE_LENGTH = 79
|
|
5
11
|
const ENGINEERING_DOCS_LINK =
|
|
6
12
|
'https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality'
|
|
@@ -14,7 +20,7 @@ module.exports = {
|
|
|
14
20
|
ENGINEERING_DOCS_LINK,
|
|
15
21
|
MAX_COMMIT_LINE_LENGTH,
|
|
16
22
|
MISSING_TICKET_CODE_ERROR_MESSAGE,
|
|
17
|
-
|
|
23
|
+
VALID_COMMIT_TITLE_REGEX,
|
|
18
24
|
VALID_PR_CODE_REGEX,
|
|
19
25
|
WHITELISTED_USERS
|
|
20
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {
|
|
2
2
|
MAX_COMMIT_LINE_LENGTH,
|
|
3
|
-
|
|
3
|
+
VALID_COMMIT_TITLE_REGEX,
|
|
4
4
|
WHITELISTED_USERS
|
|
5
5
|
} = require('../../config')
|
|
6
6
|
|
|
@@ -8,14 +8,20 @@ const validateCommitMessage = message => {
|
|
|
8
8
|
const errors = []
|
|
9
9
|
const [title = '', body = ''] = message.split(/\n\n/)
|
|
10
10
|
const bodyLines = body.split(/\n/)
|
|
11
|
-
const
|
|
11
|
+
const isTitleFormatValid = VALID_COMMIT_TITLE_REGEX.test(title)
|
|
12
12
|
const isTitleLengthValid = title.length <= MAX_COMMIT_LINE_LENGTH
|
|
13
13
|
const isBodyLinesLengthValid = bodyLines.every(
|
|
14
14
|
line => line.length <= MAX_COMMIT_LINE_LENGTH
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
if (!
|
|
18
|
-
errors.push(
|
|
17
|
+
if (!isTitleFormatValid) {
|
|
18
|
+
errors.push(`- format of commit title is not correct ([read more](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality)):
|
|
19
|
+
- Title should start with capital letter
|
|
20
|
+
- Title should not end with a full-stop (i.e .)\n
|
|
21
|
+
Example of a valid commit title:
|
|
22
|
+
- Regular commit message
|
|
23
|
+
- [FOO-1234] Commit with prefix
|
|
24
|
+
- [FOO][BAR] Coupled prefixes`)
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
if (!isTitleLengthValid) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const {
|
|
2
|
-
|
|
2
|
+
VALID_COMMIT_TITLE_REGEX,
|
|
3
3
|
VALID_PR_CODE_REGEX,
|
|
4
4
|
WHITELISTED_USERS,
|
|
5
5
|
DEFAULT_PR_TITLE_ERROR_MESSAGE,
|
|
@@ -47,7 +47,7 @@ const toptalPRTitle = () => {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const titleText = splitTitle[splitTitle.length - 1]
|
|
50
|
-
const isTitleFormatValid =
|
|
50
|
+
const isTitleFormatValid = VALID_COMMIT_TITLE_REGEX.test(titleText)
|
|
51
51
|
|
|
52
52
|
if (!isTitleFormatValid) {
|
|
53
53
|
showError()
|
|
@@ -126,7 +126,7 @@ pipeline {
|
|
|
126
126
|
-v ${PWD}/.git:/app/.git \
|
|
127
127
|
gcr.io/toptal-hub/${repositoryName}:${commitId} \
|
|
128
128
|
/bin/bash -c "yarn ${params.BUILD_PACKAGE_SCRIPT_NAME} && \
|
|
129
|
-
|
|
129
|
+
yarn davinci engine publish-package \
|
|
130
130
|
--alpha \
|
|
131
131
|
--outputVersion /artifacts/.version \
|
|
132
132
|
--branch ${sourceBranch}"
|