Skip to content

Commit 072658d

Browse files
authored
feat: remove title from the release notes
This information is redundant in the GitHub Release. BREAKING CHANGE: The title is now removed from the release notes by default. You can disable the removal of title/restore the old behavior with [`removeTitleFromReleaseNotes: false`](https://github.com/semantic-release/github#removetitlefromreleasenotes). Fixes: #316
1 parent 8d3df0e commit 072658d

File tree

8 files changed

+17302
-75
lines changed

8 files changed

+17302
-75
lines changed

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"samverschueren.linter-xo"
8+
],
9+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"xo.enable": true,
3+
"xo.format.enable": true,
4+
"[javascript]": {
5+
"editor.defaultFormatter": "samverschueren.linter-xo",
6+
"editor.formatOnSave": true
7+
},
8+
}

README.md

Lines changed: 50 additions & 25 deletions
Large diffs are not rendered by default.

lib/publish.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ module.exports = async (pluginConfig, context) => {
1515
cwd,
1616
options: {repositoryUrl},
1717
branch,
18-
nextRelease: {name, gitTag, notes},
18+
nextRelease: {name, gitTag, notes, version},
1919
logger,
2020
} = context;
21-
const {githubToken, githubUrl, githubApiPathPrefix, proxy, assets} = resolveConfig(pluginConfig, context);
21+
const {
22+
githubToken,
23+
githubUrl,
24+
githubApiPathPrefix,
25+
proxy,
26+
assets,
27+
removeTitleFromReleaseNotes: shouldRemoveTitleFromReleaseNotes,
28+
} = resolveConfig(pluginConfig, context);
2229
const {owner, repo} = parseGithubUrl(repositoryUrl);
2330
const github = getClient({githubToken, githubUrl, githubApiPathPrefix, proxy});
2431
const release = {
@@ -27,7 +34,7 @@ module.exports = async (pluginConfig, context) => {
2734
tag_name: gitTag,
2835
target_commitish: branch.name,
2936
name,
30-
body: notes,
37+
body: shouldRemoveTitleFromReleaseNotes ? removeTitleFromReleaseNotes(notes, version) : notes,
3138
prerelease: isPrerelease(branch),
3239
};
3340

@@ -104,3 +111,12 @@ module.exports = async (pluginConfig, context) => {
104111
logger.log('Published GitHub release: %s', url);
105112
return {url, name: RELEASE_NAME, id: releaseId};
106113
};
114+
115+
const removeTitleFromReleaseNotes = (notes, version) => {
116+
const titlePrefix = `### [${version}]`;
117+
if (notes.startsWith(titlePrefix)) {
118+
return notes.split('\n').slice(2).join('\n');
119+
}
120+
121+
return notes;
122+
};

lib/resolve-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = (
1313
assignees,
1414
releasedLabels,
1515
addReleases,
16+
removeTitleFromReleaseNotes,
1617
},
1718
{env}
1819
) => ({
@@ -32,4 +33,5 @@ module.exports = (
3233
? false
3334
: castArray(releasedLabels),
3435
addReleases: isNil(addReleases) ? false : addReleases,
36+
removeTitleFromReleaseNotes: isNil(removeTitleFromReleaseNotes) ? true : removeTitleFromReleaseNotes,
3537
});

lib/verify.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const VALIDATORS = {
2626
assignees: isArrayOf(isNonEmptyString),
2727
releasedLabels: canBeDisabled(isArrayOf(isNonEmptyString)),
2828
addReleases: canBeDisabled(oneOf(['bottom', 'top'])),
29+
removeTitleFromReleaseNotes: canBeDisabled(oneOf([false, true])),
2930
};
3031

3132
module.exports = async (pluginConfig, context) => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy