mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-01 14:38:47 +00:00
refactor!: optimize changelog references
Signed-off-by: Ardalan Amini <[email protected]>
This commit is contained in:
3 files changed
+19
-4
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={1932:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateChangelog=void 0;const s=a(7733);const r=a(9034);function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}function sortBy(e,t){return e.sort(((e,a)=>e[t].localeCompare(a[t])))}async function generateChangelog(e){const{paginate:t,rest:a}=(0,r.octokit)();const{owner:i,repo:p,url:n}=(0,r.repository)();const o=(0,r.defaultCommitType)();const d=(0,r.commitTypes)();const l=(0,r.includePRLinks)();const u=(0,r.includeCommitLinks)();const m=(0,r.mentionAuthors)();const c=(0,r.useGithubAutolink)();const h=t.iterator(a.repos.listCommits,{per_page:100,sha:(0,r.sha)(),owner:i,repo:p});const v=[];e:for await(const{data:t}of h){for(const a of t){if(a.sha===e)break e;const t=a.commit.message.split("\n")[0];(0,s.debug)(`commit message -> ${t}`);let{type:i,scope:p,description:h,pr:g,flag:w,breaking:y}=(0,r.parseCommitMessage)(t);if(!h)continue;h=trim(h);w=trim(w);if(w==="ignore")continue;i=d[trim(i??"")]??o;let E=v.find((e=>e.type===i));if(E==null){E={type:i,scopes:[]};v.push(E)}p=trim(p??"");let b=E.scopes.find((e=>e.scope===p));if(b==null){b={scope:p,logs:[]};E.scopes.push(b)}let _=b.logs.find((e=>e.description===h));if(_==null){_={breaking:y,description:h,references:[]};b.logs.push(_)}const D=[];if(g&&l)D.push(c?`#${g}`:`[#${g}](${n}/issues/${g})`);if((!g||!l)&&u)D.push(c?a.sha:`\`[${a.sha}](${n}/commit/${a.sha})\``);if(a.author?.login&&m)D.push(`by @${a.author.login}`);if(D.length>0)_.references.push(D.join(" "))}}const g=unique(Object.values(d).concat(o));const w=[];for(const e of g){const t=v.find((t=>t.type===e));if(t==null)continue;w.push(`## ${e}`);sortBy(t.scopes,"scope");for(const{scope:e,logs:a}of t.scopes){let t="";if(e.length>0){w.push(`* **${e}:**`);t=" "}for(const{breaking:e,description:s,references:r}of a){let a=`${t}* ${e?"***breaking:*** ":""}${s}`;if(r.length>0)a+=` (${r.join(", ")})`;w.push(a)}}w.push("")}return w.join("\n")}t.generateChangelog=generateChangelog},8251:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateFooter=void 0;const s=a(9206);const r=a(9034);async function generateFooter(e){const{owner:t,repo:a,url:i}=(0,r.repository)();const p=(0,r.releaseName)();const n=[];if((0,r.mentionNewContributors)()){const{rest:i}=(0,r.octokit)();const{data:o}=await i.repos.generateReleaseNotes({owner:t,repo:a,tag_name:p,previous_tag_name:e});const d=s.marked.lexer(o.body);const l=d.findIndex((e=>e.type==="heading"&&e.text==="New Contributors"));const u=d[l+1];if(u.type==="list")n.push(`## New Contributors\n${u.raw}\n`)}if((0,r.includeCompareLink)()&&e){const t=(0,r.useGithubAutolink)()?`${i}/compare/${e}...${p}`:`\`[${e}...${p}](${i}/compare/${e}...${p})\``;n.push(`**Full Changelog**: ${t}`)}if(n.length>0)n.unshift("");return n.join("\n\n")}t.generateFooter=generateFooter},2263:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getTagInfo=void 0;const s=a(9034);async function getTagInfo(){const{paginate:e,rest:t}=(0,s.octokit)();const{owner:a,repo:r}=(0,s.repository)();const i={releaseId:"latest",prerelease:false};let p=null;if((0,s.semver)()){p=(0,s.parseSemVer)();if(p==null)throw new Error(`Expected a semver compatible releaseName, got "${(0,s.releaseName)()}" instead.`);i.prerelease=p.prerelease.length>0;if(i.prerelease)i.releaseId=`${p.prerelease[0]}`}const n=e.iterator(t.repos.listTags,{per_page:100,owner:a,repo:r});e:for await(const{data:e}of n){for(const{name:t,commit:a}of e){if((0,s.sha)()===a.sha)continue;if(p==null){i.previous={name:t,sha:a.sha};break e}const e=(0,s.parseSemVer)(t);if(e==null||p.compare(e)<=0)continue;if(e.prerelease.length>0&&!i.prerelease)continue;i.previous={name:t,sha:a.sha};break e}}return i}t.getTagInfo=getTagInfo},6243:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.booleanInput=void 0;const s=a(7733);const r=a(927);function booleanInput(e,t=true){return(0,r.cache)(e,(()=>(0,s.getBooleanInput)(e,{required:t})))}t.booleanInput=booleanInput},927:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.cache=void 0;const a=new Map;function cache(e,t,s=false){if(!a.has(e)||s)a.set(e,t());return a.get(e)}t.cache=cache},9034:function(e,t,a){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,a,s){if(s===undefined)s=a;var r=Object.getOwnPropertyDescriptor(t,a);if(!r||("get"in r?!t.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,s,r)}:function(e,t,a,s){if(s===undefined)s=a;e[s]=t[a]});var r=this&&this.__exportStar||function(e,t){for(var a in e)if(a!=="default"&&!Object.prototype.hasOwnProperty.call(t,a))s(t,e,a)};Object.defineProperty(t,"__esModule",{value:true});r(a(8714),t);r(a(2435),t);r(a(6243),t);r(a(927),t);r(a(7557),t);r(a(1810),t);r(a(9839),t);r(a(3954),t);r(a(2574),t);r(a(6Line truncated
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={1932:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateChangelog=void 0;const s=a(7733);const r=a(9034);function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}function sortBy(e,t){return e.sort(((e,a)=>e[t].localeCompare(a[t])))}async function generateChangelog(e){const{paginate:t,rest:a}=(0,r.octokit)();const{owner:i,repo:p,url:n}=(0,r.repository)();const o=(0,r.defaultCommitType)();const d=(0,r.commitTypes)();const l=(0,r.includePRLinks)();const u=(0,r.includeCommitLinks)();const m=(0,r.mentionAuthors)();const c=(0,r.useGithubAutolink)();const h=t.iterator(a.repos.listCommits,{per_page:100,sha:(0,r.sha)(),owner:i,repo:p});const v=[];e:for await(const{data:t}of h){for(const a of t){if(a.sha===e)break e;const t=a.commit.message.split("\n")[0];(0,s.debug)(`commit message -> ${t}`);let{type:i,scope:p,description:h,pr:g,flag:w,breaking:y}=(0,r.parseCommitMessage)(t);if(!h)continue;h=trim(h);w=trim(w);if(w==="ignore")continue;i=d[trim(i??"")]??o;let E=v.find((e=>e.type===i));if(E==null){E={type:i,scopes:[]};v.push(E)}p=trim(p??"");let b=E.scopes.find((e=>e.scope===p));if(b==null){b={scope:p,logs:[]};E.scopes.push(b)}let _=b.logs.find((e=>e.description===h));if(_==null){_={breaking:y,description:h,references:[]};b.logs.push(_)}const D=[];if(g&&l)D.push(c?`#${g}`:`[#${g}](${n}/issues/${g})`);else if(u)D.push(c?a.sha:`\`[${a.sha}](${n}/commit/${a.sha})\``);const T=a.author?.login;if(T&&m){const e=`by @${T}`;D.push(e);const t=_.references[_.references.length-1];if(t?.endsWith(e)){_.references.push(_.references.pop().replace(e,`& ${D.join(" ")}`));continue}}if(D.length>0)_.references.push(D.join(" "))}}const g=unique(Object.values(d).concat(o));const w=[];for(const e of g){const t=v.find((t=>t.type===e));if(t==null)continue;w.push(`## ${e}`);sortBy(t.scopes,"scope");for(const{scope:e,logs:a}of t.scopes){let t="";if(e.length>0){w.push(`* **${e}:**`);t=" "}for(const{breaking:e,description:s,references:r}of a){let a=`${t}* ${e?"***breaking:*** ":""}${s}`;if(r.length>0)a+=` (${r.join(", ")})`;w.push(a)}}w.push("")}return w.join("\n")}t.generateChangelog=generateChangelog},8251:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateFooter=void 0;const s=a(9206);const r=a(9034);async function generateFooter(e){const{owner:t,repo:a,url:i}=(0,r.repository)();const p=(0,r.releaseName)();const n=[];if((0,r.mentionNewContributors)()){const{rest:i}=(0,r.octokit)();const{data:o}=await i.repos.generateReleaseNotes({owner:t,repo:a,tag_name:p,previous_tag_name:e});const d=s.marked.lexer(o.body);const l=d.findIndex((e=>e.type==="heading"&&e.text==="New Contributors"));const u=d[l+1];if(u.type==="list")n.push(`## New Contributors\n${u.raw}\n`)}if((0,r.includeCompareLink)()&&e){const t=(0,r.useGithubAutolink)()?`${i}/compare/${e}...${p}`:`\`[${e}...${p}](${i}/compare/${e}...${p})\``;n.push(`**Full Changelog**: ${t}`)}if(n.length>0)n.unshift("");return n.join("\n\n")}t.generateFooter=generateFooter},2263:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getTagInfo=void 0;const s=a(9034);async function getTagInfo(){const{paginate:e,rest:t}=(0,s.octokit)();const{owner:a,repo:r}=(0,s.repository)();const i={releaseId:"latest",prerelease:false};let p=null;if((0,s.semver)()){p=(0,s.parseSemVer)();if(p==null)throw new Error(`Expected a semver compatible releaseName, got "${(0,s.releaseName)()}" instead.`);i.prerelease=p.prerelease.length>0;if(i.prerelease)i.releaseId=`${p.prerelease[0]}`}const n=e.iterator(t.repos.listTags,{per_page:100,owner:a,repo:r});e:for await(const{data:e}of n){for(const{name:t,commit:a}of e){if((0,s.sha)()===a.sha)continue;if(p==null){i.previous={name:t,sha:a.sha};break e}const e=(0,s.parseSemVer)(t);if(e==null||p.compare(e)<=0)continue;if(e.prerelease.length>0&&!i.prerelease)continue;i.previous={name:t,sha:a.sha};break e}}return i}t.getTagInfo=getTagInfo},6243:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.booleanInput=void 0;const s=a(7733);const r=a(927);function booleanInput(e,t=true){return(0,r.cache)(e,(()=>(0,s.getBooleanInput)(e,{required:t})))}t.booleanInput=booleanInput},927:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.cache=void 0;const a=new Map;function cache(e,t,s=false){if(!a.has(e)||s)a.set(e,t());return a.get(e)}t.cache=cache},9034:function(e,t,a){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,a,s){if(s===undefined)s=a;var r=Object.getOwnPropertyDescriptor(t,a);if(!r||("get"in r?!t.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,s,r)}:function(e,t,a,s){if(s===undefined)s=a;e[s]=t[a]});var r=this&&this.__exportStar||function(e,t){for(var a in e)if(a!=="default"&&!Object.prototype.hasOwnProperty.call(t,a))s(t,e,a)};Object.defineProperty(t,"__eLine truncated
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/footer.js","../webpack:/auto-changelog/dist/tag.js","../webpack:/auto-changelog/dist/utils/boolean-input.js","../webpack:/auto-changelog/dist/utils/cache.js","../webpack:/auto-changelog/dist/utils/index.js","../webpack:/auto-changelog/dist/utils/input.js","../webpack:/auto-changelog/dist/utils/inputs/commit-types.js","../webpack:/auto-changelog/dist/utils/inputs/default-commit-type.js","../webpack:/auto-changelog/dist/utils/inputs/include-commit-links.js","../webpack:/auto-changelog/dist/utils/inputs/include-compare-link.js","../webpack:/auto-changelog/dist/utils/inputs/include-pr-links.js","../webpack:/auto-changelog/dist/utils/inputs/index.js","../webpack:/auto-changelog/dist/utils/inputs/mention-authors.js","../webpack:/auto-changelog/dist/utils/inputs/mention-new-contributors.js","../webpack:/auto-changelog/dist/utils/inputs/release-name.js","../webpack:/auto-changelog/dist/utils/inputs/semver.js","../webpack:/auto-changelog/dist/utils/inputs/token.js","../webpack:/auto-changelog/dist/utils/inputs/use-github-autolink.js","../webpack:/auto-changelog/dist/utils/octokit.js","../webpack:/auto-changelog/dist/utils/output.js","../webpack:/auto-changelog/dist/utils/outputs/index.js","../webpack:/auto-changelog/dist/utils/outputs/set-changelog.js","../webpack:/auto-changelog/dist/utils/outputs/set-prerelease.js","../webpack:/auto-changelog/dist/utils/outputs/set-release-id.js","../webpack:/auto-changelog/dist/utils/parse-commit-message.js","../webpack:/auto-changelog/dist/utils/parse-semver.js","../webpack:/auto-changelog/dist/utils/repository.js","../webpack:/auto-changelog/dist/utils/sha.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/path-utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/summary.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/http-client/lib/auth.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/http-client/lib/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/http-client/lib/proxy.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/deprecation/dist-node/index.js","../webpack:/Line truncated
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/footer.js","../webpack:/auto-changelog/dist/tag.js","../webpack:/auto-changelog/dist/utils/boolean-input.js","../webpack:/auto-changelog/dist/utils/cache.js","../webpack:/auto-changelog/dist/utils/index.js","../webpack:/auto-changelog/dist/utils/input.js","../webpack:/auto-changelog/dist/utils/inputs/commit-types.js","../webpack:/auto-changelog/dist/utils/inputs/default-commit-type.js","../webpack:/auto-changelog/dist/utils/inputs/include-commit-links.js","../webpack:/auto-changelog/dist/utils/inputs/include-compare-link.js","../webpack:/auto-changelog/dist/utils/inputs/include-pr-links.js","../webpack:/auto-changelog/dist/utils/inputs/index.js","../webpack:/auto-changelog/dist/utils/inputs/mention-authors.js","../webpack:/auto-changelog/dist/utils/inputs/mention-new-contributors.js","../webpack:/auto-changelog/dist/utils/inputs/release-name.js","../webpack:/auto-changelog/dist/utils/inputs/semver.js","../webpack:/auto-changelog/dist/utils/inputs/token.js","../webpack:/auto-changelog/dist/utils/inputs/use-github-autolink.js","../webpack:/auto-changelog/dist/utils/octokit.js","../webpack:/auto-changelog/dist/utils/output.js","../webpack:/auto-changelog/dist/utils/outputs/index.js","../webpack:/auto-changelog/dist/utils/outputs/set-changelog.js","../webpack:/auto-changelog/dist/utils/outputs/set-prerelease.js","../webpack:/auto-changelog/dist/utils/outputs/set-release-id.js","../webpack:/auto-changelog/dist/utils/parse-commit-message.js","../webpack:/auto-changelog/dist/utils/parse-semver.js","../webpack:/auto-changelog/dist/utils/repository.js","../webpack:/auto-changelog/dist/utils/sha.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/path-utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/summary.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/http-client/lib/auth.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/http-client/lib/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@actions/http-client/lib/proxy.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/deprecation/dist-node/index.js","../webpack:/Line truncated
|
||||
+17
-2
@@ -150,10 +150,25 @@ export async function generateChangelog(lastSha?: string): Promise<string> {
|
||||
const reference: string[] = [];
|
||||
|
||||
if (pr && shouldIncludePRLinks) reference.push(shouldUseGithubAutolink ? `#${ pr }` : `[#${ pr }](${ url }/issues/${ pr })`);
|
||||
else if (shouldIncludeCommitLinks) reference.push(shouldUseGithubAutolink ? commit.sha : `\`[${ commit.sha }](${ url }/commit/${ commit.sha })\``);
|
||||
|
||||
if ((!pr || !shouldIncludePRLinks) && shouldIncludeCommitLinks) reference.push(shouldUseGithubAutolink ? commit.sha : `\`[${ commit.sha }](${ url }/commit/${ commit.sha })\``);
|
||||
const username = commit.author?.login;
|
||||
|
||||
if (commit.author?.login && shouldMentionAuthors) reference.push(`by @${ commit.author.login }`);
|
||||
if (username && shouldMentionAuthors) {
|
||||
const mention = `by @${ username }`;
|
||||
|
||||
reference.push(mention);
|
||||
|
||||
const lastReference = log.references[log.references.length - 1];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (lastReference?.endsWith(mention)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
log.references.push(log.references.pop()!.replace(mention, `& ${ reference.join(" ") }`));
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (reference.length > 0) log.references.push(reference.join(" "));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user