@@ -597,11 +597,27 @@ it('Extract custom placeholder from PR body and replace in global template', asy
|
||||
pattern: '.+ b(....).+',
|
||||
target: '\n- $1'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'C_PLACEHOLER_3',
|
||||
source: 'BODY',
|
||||
transformer: {
|
||||
pattern: '.+(body1).+',
|
||||
target: '$1'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'C_PLACEHOLER_4',
|
||||
source: 'BODY',
|
||||
transformer: {
|
||||
pattern: '.+(body-never-matches).+',
|
||||
target: '$1'
|
||||
}
|
||||
}
|
||||
]
|
||||
customConfig.template =
|
||||
'${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}'
|
||||
customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}'
|
||||
'${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}${{C_PLACEHOLER_4[*]}}${{C_PLACEHOLER_4[0]}}${{C_PLACEHOLER_3[1]}}'
|
||||
customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}${{C_PLACEHOLER_3}}'
|
||||
|
||||
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
|
||||
owner: 'mikepenz',
|
||||
@@ -617,6 +633,6 @@ it('Extract custom placeholder from PR body and replace in global template', asy
|
||||
})
|
||||
|
||||
expect(resultChangelog).toStrictEqual(
|
||||
`## 🚀 Features\n\nno magic body1 for this matter ----> - body1\nno magic body3 for this matter ----> - body3\n\n## 🐛 Fixes\n\nno magic body2 for this matter ----> - body2\nno magic body3 for this matter ----> - body3\n\n## 🧪 Others\n\nno magic body4 for this matter ----> - body4\n\n\n\n\n- ody3\n\n\n- ody1\n- ody2\n- ody3\n- ody4`
|
||||
`## 🚀 Features\n\nno magic body1 for this matter ----> - body1body1\nno magic body3 for this matter ----> - body3\n\n## 🐛 Fixes\n\nno magic body2 for this matter ----> - body2\nno magic body3 for this matter ----> - body3\n\n## 🧪 Others\n\nno magic body4 for this matter ----> - body4\n\n\n\n\n- ody3\n\n\n- ody1\n- ody2\n- ody3\n- ody4`
|
||||
)
|
||||
})
|
||||
|
||||
+18
-10
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Generated
+269
-356
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -35,8 +35,8 @@
|
||||
"@actions/core": "^1.9.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^5.0.3",
|
||||
"@octokit/rest": "^19.0.3",
|
||||
"@types/semver": "^7.3.10",
|
||||
"@octokit/rest": "^19.0.4",
|
||||
"@types/semver": "^7.3.12",
|
||||
"https-proxy-agent": "^5.0.1",
|
||||
"moment": "^2.29.4",
|
||||
"semver": "^7.3.7",
|
||||
@@ -44,18 +44,18 @@
|
||||
"webpack": "^5.74.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^28.1.6",
|
||||
"@types/node": "^18.6.5",
|
||||
"@typescript-eslint/parser": "^5.33.0",
|
||||
"@types/jest": "^28.1.7",
|
||||
"@types/node": "^18.7.6",
|
||||
"@typescript-eslint/parser": "^5.33.1",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint": "^8.22.0",
|
||||
"eslint-plugin-github": "^4.3.7",
|
||||
"eslint-plugin-jest": "^26.8.2",
|
||||
"eslint-plugin-jest": "^26.8.3",
|
||||
"jest": "^28.1.3",
|
||||
"jest-circus": "^28.1.3",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "2.7.1",
|
||||
"ts-jest": "^28.0.7",
|
||||
"ts-jest": "^28.0.8",
|
||||
"typescript": "^4.7.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,6 @@ function semVerSorting(tags: TagInfo[]): TagInfo[] {
|
||||
const validatedTags = tags.filter(tag => {
|
||||
const isValid =
|
||||
semver.valid(tag.name, {
|
||||
includePrerelease: true,
|
||||
loose: true
|
||||
}) !== null
|
||||
if (!isValid) {
|
||||
|
||||
+1
-1
@@ -379,7 +379,7 @@ function cleanupPrPlaceHolders(
|
||||
let transformed = template
|
||||
for (const [, phs] of placeholders) {
|
||||
for (const ph of phs) {
|
||||
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}\\[.+?\\]\\}\\}`, 'gu'), '')
|
||||
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}(?:\\[.+?\\])?\\}\\}`, 'gu'), '')
|
||||
}
|
||||
}
|
||||
return transformed
|
||||
|
||||
Reference in New Issue
Block a user