Skip to content

Commit

Permalink
refactor!: don't include the commit sha when pull request reference i…
Browse files Browse the repository at this point in the history
…s included

Signed-off-by: Ardalan Amini <ardalanamini22@gmail.com>
  • Loading branch information
ardalanamini committed Apr 29, 2023
1 parent 4538068 commit d9c18ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion action/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion action/index.js.map

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export async function generateChangelog(lastSha?: string): Promise<string> {
const { owner, repo, url } = repository();
const defaultType = defaultCommitType();
const typeMap = commitTypes();
const shouldIncludePRLinks = includePRLinks();
const shouldIncludeCommitLinks = includeCommitLinks();
const shouldMentionAuthors = mentionAuthors();

const iterator = paginate.iterator(
rest.repos.listCommits,
Expand Down Expand Up @@ -142,11 +145,11 @@ export async function generateChangelog(lastSha?: string): Promise<string> {

const reference: string[] = [];

if (pr && includePRLinks()) reference.push(`${ url }/issues/${ pr }`);
if (pr && shouldIncludePRLinks) reference.push(`${ url }/issues/${ pr }`);

if (includeCommitLinks()) reference.push(`${ url }/commit/${ commit.sha }`);
if ((!pr || !shouldIncludePRLinks) && shouldIncludeCommitLinks) reference.push(`${ url }/commit/${ commit.sha }`);

if (commit.author?.login && mentionAuthors()) reference.push(`by @${ commit.author.login }`);
if (commit.author?.login && shouldMentionAuthors) reference.push(`by @${ commit.author.login }`);

if (reference.length > 0) log.references.push(reference.join(" "));
}
Expand Down

0 comments on commit d9c18ae

Please sign in to comment.