Skip to content

Commit 99fb581

Browse files
committed
chore: add support for commits
1 parent 59277d6 commit 99fb581

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,20 @@ async function getReleaseLine(
112112
const prNumber =
113113
prFromSummary ||
114114
changeset.PR ||
115-
githubInfo.links?.pull?.match(/#(\d+)/)?.[1];
115+
(githubInfo.links?.pull
116+
? githubInfo.links.pull.match(/#(\d+)/)?.[1]
117+
: undefined);
118+
119+
// Get commit hash for the change
120+
const commitHash = commitFromSummary || changeset.commit;
116121

117122
// Build the release line in the requested format
118123
let result = `- ${firstLine}`;
119124

120125
if (prNumber) {
121126
result += ` ([#${prNumber}](https://github.com/${repo}/pull/${prNumber}))`;
127+
} else if (commitHash) {
128+
result += ` ([\`${commitHash}\`](https://github.com/${repo}/commit/${commitHash}))`;
122129
}
123130

124131
if (futureLines.length > 0) {
@@ -217,8 +224,8 @@ const wrappedGetReleaseLine: ChangelogFunctions["getReleaseLine"] = async (
217224
opts
218225
) => {
219226
const result = await getReleaseLine(changeset as ChangesetWithPR, type, opts);
220-
// Add credits section only for the last changeset
221-
if (opts?.isLast && allAuthors.size > 0) {
227+
// Only add credits section if this is the last changeset
228+
if (opts?.isLast) {
222229
return result + getCreditsSection();
223230
}
224231
return result;
@@ -231,8 +238,8 @@ const wrappedGetDependencyReleaseLine: ChangelogFunctions["getDependencyReleaseL
231238
dependencies,
232239
opts
233240
);
234-
// Add credits section only if there are no regular changesets
235-
if (opts?.isLast && changesets.length === 0 && allAuthors.size > 0) {
241+
// Only add credits section if this is the last entry and there are no regular changesets
242+
if (opts?.isLast && changesets.length === 0) {
236243
return result + getCreditsSection();
237244
}
238245
return result;

0 commit comments

Comments
 (0)