Skip to content

Commit e244868

Browse files
committed
chore: clean up
1 parent 6dde61b commit e244868

16 files changed

Lines changed: 4375 additions & 2484 deletions

File tree

.changeset/changelog.js

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ export default {
3030
/** @type string[] */
3131
const usersFromSummary = [];
3232

33-
// Parse summary to extract scope and description
34-
const summary = changeset.summary;
35-
3633
// Remove PR, commit, author/user lines from summary
37-
const replacedChangelog = summary
34+
const replacedChangelog = changeset.summary
3835
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
3936
const num = Number(pr);
4037
if (!Number.isNaN(num)) {
@@ -52,24 +49,6 @@ export default {
5249
})
5350
.trim();
5451

55-
// Detect scope from **scope**: format
56-
const scopeMatch = replacedChangelog.match(/^\*\*([^:]+)\*\*:?\s*(.*)$/);
57-
const scope = scopeMatch ? scopeMatch[1] : null;
58-
const description = scopeMatch ? scopeMatch[2] : replacedChangelog;
59-
60-
// Detect breaking changes (explicit BREAKING or major version) - for future use
61-
const explicitBreaking =
62-
/^BREAKING[:\s]/i.test(replacedChangelog) || /\bBREAKING CHANGE\b/i.test(replacedChangelog);
63-
void explicitBreaking;
64-
65-
// Build formatted entry
66-
const entryParts = [];
67-
if (scope) {
68-
entryParts.push(`**${scope}**: ${description}`);
69-
} else {
70-
entryParts.push(description);
71-
}
72-
7352
const links = await (async () => {
7453
if (prFromSummary !== undefined) {
7554
let { links } = await getInfoFromPullRequest({
@@ -102,13 +81,27 @@ export default {
10281
};
10382
})();
10483

105-
// Add PR link at end
106-
if (links.pull) {
107-
entryParts.push(`(${links.pull})`);
108-
} else if (prFromSummary !== undefined) {
109-
entryParts.push(`([#${prFromSummary}](https://github.com/${repo}/pull/${prFromSummary}))`);
110-
}
84+
const users = usersFromSummary.length
85+
? usersFromSummary
86+
.map((userFromSummary) => `[@${userFromSummary}](https://github.com/${userFromSummary})`)
87+
.join(', ')
88+
: links.user;
89+
90+
const metadata = [
91+
links.pull === null ? '' : ` (${links.pull})`,
92+
links.commit === null ? '' : ` (${links.commit})`,
93+
users === null ? '' : ` by ${users}`,
94+
].join('');
11195

112-
return `\n- ${entryParts.join(' ')}`;
96+
// Split summary into first line and the rest
97+
const [firstLine, ...rest] = replacedChangelog.split('\n');
98+
const restSummary = rest.join('\n').trim();
99+
100+
// No code block conversion: preserve original triple backtick code blocks and indentation
101+
let releaseLine = `\n- ${firstLine}${metadata}`;
102+
if (restSummary) {
103+
releaseLine += '\n\n' + restSummary;
104+
}
105+
return releaseLine;
113106
},
114107
};

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
33
"access": "public",
44
"baseBranch": "main",
5-
"changelog": ["./changelog.js", { "repo": "hey-api/openapi-ts" }],
5+
"changelog": "./changelog.js",
66
"commit": false,
77
"fixed": [],
88
"ignore": [],

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ jobs:
5959

6060
- name: Generate Release Tag
6161
id: tag
62-
run: echo "tag=$(pnpm changelog:release:tag)" >> $GITHUB_OUTPUT
62+
run: echo "tag=$(pnpm -s changelog:release:tag)" >> $GITHUB_OUTPUT
6363

6464
- name: Generate Release Notes
6565
id: notes
66-
run: pnpm changelog:release:notes > release-notes.md
66+
run: pnpm -s changelog:release:notes > release-notes.md
6767

6868
- name: Create GitHub Release
69-
uses: softprops/action-gh-release@v2
69+
uses: softprops/action-gh-release@v2.6.1
7070
with:
71-
tag_name: ${{ steps.tag.outputs.tag }}
72-
name: Release ${{ steps.tag.outputs.tag }}
7371
body_path: release-notes.md
7472
generate_release_notes: false
73+
name: Release ${{ steps.tag.outputs.tag }}
74+
tag_name: ${{ steps.tag.outputs.tag }}
7575
env:
7676
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
7777

0 commit comments

Comments
 (0)