mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-01 14:38:47 +00:00
refactor: improve code quality (#138)
Signed-off-by: Ardalan Amini <[email protected]>
This commit is contained in:
1 parent
1e734abbf9
commit
418818d74b
40 files changed
+2210
-467
No files matched your search
@@ -9,3 +9,4 @@ parserOptions:
|
||||
sourceType: module
|
||||
rules:
|
||||
import/extensions: off
|
||||
import/no-relative-parent-imports: off
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env sh
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2023 Ardalan Amini
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
#
|
||||
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm commitlint --edit "$1"
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env sh
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2023 Ardalan Amini
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
#
|
||||
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm lint:fix
|
||||
|
||||
pnpm build
|
||||
|
||||
pnpm package
|
||||
|
||||
git add action
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={1932:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;const s=r(1403);function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}async function generate(e){const{octokit:t,owner:r,repo:a,sha:i,tagRef:n,inputs:o}=e;const{commitTypes:p,defaultCommitType:l,mentionAuthors:d,includePRLinks:u,includeCommitLinks:c}=o;const m=`https://github.com/${r}/${a}`;const h={};e:for await(const{data:e}of t.paginate.iterator(t.rest.repos.listCommits,{per_page:100,owner:r,repo:a,sha:i})){for(const t of e){if(t.sha===n)break e;const e=t.commit.message.split("\n")[0];let{type:r,category:a,title:i,pr:o,flag:m}=s.COMMIT_REGEX.exec(e)?.groups??{};if(!i)continue;m=trim(m);if(m==="ignore")continue;r=p[trim(r)]??l;a=a?trim(a):"";i=trim(i);let g=h[r];g??=h[r]={};let v=g[a];v??=g[a]=[];const y=v.find((e=>e.title===i));const b={author:d?t.author?.login:null,commit:c?t.sha:null,pr:u?o:null};if(y==null){v.push({title:i,references:[b]})}else{y.references.push(b)}}}const g=unique([...Object.values(p),l]);return g.reduce(((e,t)=>{const r=h[t];if(r==null)return e;e.push(`## ${t}`);const a=Object.keys(r).sort();for(const t of a){const a=r[t];const i=t.length===0;if(!i)e.push(`* **${t}:**`);const n=i?"":" ";for(const{title:t,references:r}of a){let a=`${n}* ${t}`;const i=[];for(const{pr:e,commit:t,author:a}of r){const r=[];if(e!=null)r.push(`${m}/pull/${e}`);if(t!=null)r.push(`${m}/commit/${t}`);if(a!=null){if(a.endsWith(s.APP_AUTHOR_SUFFIX))r.push(`by [@${a}](https://github.com/apps/${a.slice(0,-s.APP_AUTHOR_SUFFIX_LENGTH)})`);else r.push(`by @${a}`)}if(r.length>0)i.push(r.join(" "))}if(i.length>0)a+=` (${i.join(", ")})`;e.push(a)}}e.push("");return e}),[]).join("\n")}t.generate=generate},1403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.APP_AUTHOR_SUFFIX_LENGTH=t.APP_AUTHOR_SUFFIX=t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^(?<type>[^:()]*)(?:\((?<category>[^()]*?)\)|): *(?<title>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;t.APP_AUTHOR_SUFFIX="[bot]";t.APP_AUTHOR_SUFFIX_LENGTH=t.APP_AUTHOR_SUFFIX.length},21:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getInputs=t.getToken=void 0;const a=r(7733);const i=s(r(5916));const n=s(r(8368));function getToken(){return(0,a.getInput)("github-token",{required:true})}t.getToken=getToken;async function getInputs(){const e=n.default.parse((0,a.getInput)("commit-types",{required:true}));const t=(0,a.getInput)("default-commit-type",{required:true});const r=(0,a.getInput)("release-name",{required:true});const s=(0,a.getBooleanInput)("mention-authors",{required:true});const o=(0,a.getBooleanInput)("mention-new-contributors",{required:true});const p=(0,a.getBooleanInput)("include-compare",{required:true});const l=(0,a.getBooleanInput)("include-pr-links",{required:true});const d=(0,a.getBooleanInput)("include-commit-links",{required:true});const u=(0,a.getBooleanInput)("semver",{required:true});return i.default.object().keys({commitTypes:i.default.object().pattern(i.default.string(),i.default.string()).required(),defaultCommitType:i.default.string().required(),releaseName:i.default.string().required(),mentionAuthors:i.default.boolean().required(),mentionNewContributors:i.default.boolean().required(),includeCompare:i.default.boolean().required(),includePRLinks:i.default.boolean().required(),includeCommitLinks:i.default.boolean().required(),semver:i.default.boolean().required()}).validateAsync({commitTypes:e,defaultCommitType:t,releaseName:r,mentionAuthors:s,mentionNewContributors:o,includeCompare:p,includePRLinks:l,includeCommitLinks:d,semver:u})}t.getInputs=getInputs},2263:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getTagSha=void 0;const s=r(815);async function getTagSha(e){const{octokit:t,owner:r,repo:a,sha:i,semver:n,prerelease:o}=e;for await(const{data:e}of t.paginate.iterator(t.rest.repos.listTags,{per_page:100,owner:r,repo:a})){for(const{name:t,commit:{sha:r}}of e){if(i===r)continue;if(n==null){return{sha:r,name:t}}const e=(0,s.parse)(t,{includePrerelease:true});if(e==null||n.compare(e)<=0)continue;if(e.prerelease.length>0&&!o)continue;return{sha:r,name:t}}}return{}}t.getTagSha=getTagSha},9483:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){if(s===undefined)s=r;Object.defineProperty(e,s,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,s){if(s===undefined)s=r;e[s]=t[r]});var a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))s(t,e,r);a(Line 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=t.iterator(a.repos.listCommits,{per_page:100,sha:(0,r.sha)(),owner:i,repo:p});const u=[];e:for await(const{data:t}of l){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:l,pr:m,flag:c}=(0,r.parseCommitMessage)(t);if(!l)continue;l=trim(l);c=trim(c);if(c==="ignore")continue;i=d[trim(i??"")]??o;let h=u.find((e=>e.type===i));if(h==null){h={type:i,scopes:[]};u.push(h)}p=trim(p??"");let v=h.scopes.find((e=>e.scope===p));if(v==null){v={scope:p,logs:[]};h.scopes.push(v)}let g=v.logs.find((e=>e.description===l));if(g==null){g={description:l,references:[]};v.logs.push(g)}const w=[];if(m&&(0,r.includePRLinks)())w.push(`${n}/issues/${m}`);if((0,r.includeCommitLinks)())w.push(`${n}/commit/${a.sha}`);if(a.author?.login&&(0,r.mentionAuthors)())w.push(`by @${a.author.login}`);if(w.length>0)g.references.push(w.join(" "))}}const m=unique(Object.values(d).concat(o));const c=[];for(const e of m){const t=u.find((t=>t.type===e));if(t==null)continue;c.push(`## ${e}`);sortBy(t.scopes,"scope");for(const{scope:e,logs:a}of t.scopes){let t="";if(e.length>0){c.push(`* **${e}:**`);t=" "}for(const{description:e,references:s}of a){let a=`${t}* ${e}`;if(s.length>0)a+=` (${s.join(", ")})`;c.push(a)}}c.push("")}return c.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)n.push(`**Full Changelog**: ${i}/compare/${e}...${p}`);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(615),t);r(a(3648),t)},7557:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.input=void 0;const s=a(7733);const r=a(927);function input(e,t=(e=>e),a=true){return(0,r.cache)(e,(()=>t((0,s.getInput)(e,{required:a}))))}t.input=input},6816:funLine truncated
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},6268:(e,t,r)=>{"use strict";const s=r(2543);const a=r(7912);const i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||typeof this._original!=="object"){return this.details[0].message}const t=e?"":"[31m";const r=e?"":"[41m";const n=e?"":"[0m";const o=s(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1;const r=this.details[e];const s=r.path;let n=o;for(let e=0;;++e){const o=s[e];if(a.isSchema(n)){n=n.clone()}if(e+1<s.length&&typeof n[o]!=="string"){n=n[o]}else{const e=n[i.annotations]||{errors:{},missing:{}};n[i.annotations]=e;const s=o||r.context.key;if(n[o]!==undefined){e.errors[s]=e.errors[s]||[];e.errors[s].push(t)}else{e.missing[s]=t}break}}}const p={key:/_\$key\$_([, \d]+)_\$end\$_"/g,missing:/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,arrayIndex:/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,specials:/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g};let l=i.safeStringify(o,2).replace(p.key,((e,r)=>`" ${t}[${r}]${n}`)).replace(p.missing,((e,s,a)=>`${r}"${s}"${n}${t} [${a}]: -- missing --${n}`)).replace(p.arrayIndex,((e,r,s)=>`\n${s} ${t}[${r}]${n}`)).replace(p.specials,((e,t)=>t));l=`${l}\n${t}`;for(let e=0;e<this.details.length;++e){const t=e+1;l=`${l}\n[${t}] ${this.details[e].message}`}l=l+n;return l};i.safeStringify=function(e,t){return JSON.stringify(e,i.serializer(),t)};i.serializer=function(){const e=[];const t=[];const cycleReplacer=(r,s)=>{if(t[0]===s){return"[Circular ~]"}return"[Circular ~."+e.slice(0,t.indexOf(s)).join(".")+"]"};return function(r,s){if(t.length>0){const a=t.indexOf(this);if(~a){t.length=a+1;e.length=a+1;e[a]=r}else{t.push(this);e.push(r)}if(~t.indexOf(s)){s=cycleReplacer.call(this,r,s)}}else{t.push(s)}if(s){const e=s[i.annotations];if(e){if(Array.isArray(s)){const t=[];for(let r=0;r<s.length;++r){if(e.errors[r]){t.push(`_$idx$_${e.errors[r].sort().join(", ")}_$end$_`)}t.push(s[r])}s=t}else{for(const t in e.errors){s[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=s[t];s[t]=undefined}for(const t in e.missing){s[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}}return s}}if(s===Infinity||s===-Infinity||Number.isNaN(s)||typeof s==="function"||typeof s==="symbol"){return"["+s.toString()+"]"}return s}}},5414:(e,t,r)=>{"use strict";const s=r(1430);const a=r(2543);const i=r(4095);const n=r(8287);const o=r(9335);const p=r(7912);const l=r(4971);const d=r(5564);const u=r(4544);const c=r(3121);const m=r(1234);const h=r(6431);const g=r(8399);const v=r(1067);const y=r(7727);const b=r(3234);const w={};w.Base=class{constructor(e){this.type=e;this.$_root=null;this._definition={};this._reset()}_reset(){this._ids=new h.Ids;this._preferences=null;this._refs=new g.Manager;this._cache=null;this._valids=null;this._invalids=null;this._flags={};this._rules=[];this._singleRules=new Map;this.$_terms={};this.$_temp={ruleset:null,whens:{}}}describe(){s(typeof c.describe==="function","Manifest functionality disabled");return c.describe(this)}allow(...e){p.verifyFlat(e,"allow");return this._values(e,"_valids")}alter(e){s(e&&typeof e==="object"&&!Array.isArray(e),"Invalid targets argument");s(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const a=e[r];s(typeof a==="function","Alteration adjuster for",r,"must be a function");t.$_terms.alterations.push({target:r,adjuster:a})}t.$_temp.ruleset=false;return t}artifact(e){s(e!==undefined,"Artifact cannot be undefined");s(!this._cache,"Cannot set an artifact with a rule cache");return this.$_setFlag("artifact",e)}cast(e){s(e===false||typeof e==="string","Invalid to value");s(e===false||this._definition.cast[e],"Type",this.type,"does not support casting to",e);return this.$_setFlag("cast",e===false?undefined:e)}default(e,t){return this._default("default",e,t)}description(e){s(e&&typeof e==="string","Description must be a non-empty string");return this.$_setFlag("description",e)}empty(e){const t=this.clone();if(e!==undefined){e=t.$_compile(e,{override:false})}return t.$_setFlag("empty",e,{clone:false})}error(e){s(e,"Missing error");s(e instanceof Error||typeof e==="function","Must provide a valid Error object or a function");return this.$_setFlag("error",e)}example(e,t={}){s(e!==undefined,"Missing example");p.assertOptions(t,["override"]);return this._inner("examples",e,{single:true,override:t.override})}external(e,t){if(typeof e==="object"){s(!t,"Cannot combine options with description");t=e.description;e=e.method}s(typeof e==="function","Method must be a function");s(t===undefined||t&&typeof t==="string","Description must be a non-empty string");retuLine truncated
|
||||
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,a;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;a=t.prototype;if(isObject(a)===false)return false;if(a.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},4965:(e,t,a)=>{"use strict";const s=a(1590);const r=Symbol("max");const i=Symbol("length");const p=Symbol("lengthCalculator");const n=Symbol("allowStale");const o=Symbol("maxAge");const d=Symbol("dispose");const l=Symbol("noDisposeOnSet");const u=Symbol("lruList");const m=Symbol("cache");const c=Symbol("updateAgeOnGet");const naiveLength=()=>1;class LRUCache{constructor(e){if(typeof e==="number")e={max:e};if(!e)e={};if(e.max&&(typeof e.max!=="number"||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[r]=e.max||Infinity;const a=e.length||naiveLength;this[p]=typeof a!=="function"?naiveLength:a;this[n]=e.stale||false;if(e.maxAge&&typeof e.maxAge!=="number")throw new TypeError("maxAge must be a number");this[o]=e.maxAge||0;this[d]=e.dispose;this[l]=e.noDisposeOnSet||false;this[c]=e.updateAgeOnGet||false;this.reset()}set max(e){if(typeof e!=="number"||e<0)throw new TypeError("max must be a non-negative number");this[r]=e||Infinity;trim(this)}get max(){return this[r]}set allowStale(e){this[n]=!!e}get allowStale(){return this[n]}set maxAge(e){if(typeof e!=="number")throw new TypeError("maxAge must be a non-negative number");this[o]=e;trim(this)}get maxAge(){return this[o]}set lengthCalculator(e){if(typeof e!=="function")e=naiveLength;if(e!==this[p]){this[p]=e;this[i]=0;this[u].forEach((e=>{e.length=this[p](e.value,e.key);this[i]+=e.length}))}trim(this)}get lengthCalculator(){return this[p]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t=t||this;for(let a=this[u].tail;a!==null;){const s=a.prev;forEachStep(this,e,a,t);a=s}}forEach(e,t){t=t||this;for(let a=this[u].head;a!==null;){const s=a.next;forEachStep(this,e,a,t);a=s}}keys(){return this[u].toArray().map((e=>e.key))}values(){return this[u].toArray().map((e=>e.value))}reset(){if(this[d]&&this[u]&&this[u].length){this[u].forEach((e=>this[d](e.key,e.value)))}this[m]=new Map;this[u]=new s;this[i]=0}dump(){return this[u].map((e=>isStale(this,e)?false:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[u]}set(e,t,a){a=a||this[o];if(a&&typeof a!=="number")throw new TypeError("maxAge must be a number");const s=a?Date.now():0;const n=this[p](t,e);if(this[m].has(e)){if(n>this[r]){del(this,this[m].get(e));return false}const p=this[m].get(e);const o=p.value;if(this[d]){if(!this[l])this[d](e,o.value)}o.now=s;o.maxAge=a;o.value=t;this[i]+=n-o.length;o.length=n;this.get(e);trim(this);return true}const c=new Entry(e,t,n,s,a);if(c.length>this[r]){if(this[d])this[d](e,t);return false}this[i]+=c.length;this[u].unshift(c);this[m].set(e,this[u].head);trim(this);return true}has(e){if(!this[m].has(e))return false;const t=this[m].get(e).value;return!isStale(this,t)}get(e){return get(this,e,true)}peek(e){return get(this,e,false)}pop(){const e=this[u].tail;if(!e)return null;del(this,e);return e.value}del(e){del(this,this[m].get(e))}load(e){this.reset();const t=Date.now();for(let a=e.length-1;a>=0;a--){const s=e[a];const r=s.e||0;if(r===0)this.set(s.k,s.v);else{const e=r-t;if(e>0){this.set(s.k,s.v,e)}}}}prune(){this[m].forEach(((e,t)=>get(this,t,false)))}}const get=(e,t,a)=>{const s=e[m].get(t);if(s){const t=s.value;if(isStale(e,t)){del(e,s);if(!e[n])return undefined}else{if(a){if(e[c])s.value.now=Date.now();e[u].unshiftNode(s)}}return t.value}};const isStale=(e,t)=>{if(!t||!t.maxAge&&!e[o])return false;const a=Date.now()-t.now;return t.maxAge?a>t.maxAge:e[o]&&a>e[o]};const trim=e=>{if(e[i]>e[r]){for(let t=e[u].tail;e[i]>e[r]&&t!==null;){const a=t.prev;del(e,t);t=a}}};const del=(e,t)=>{if(t){const a=t.value;if(e[d])e[d](a.key,a.value);e[i]-=a.length;e[m].delete(a.key);e[u].removeNode(t)}};class Entry{constructor(e,t,a,s,r){this.key=e;this.value=t;this.length=a;this.now=s;this.maxAge=r||0}}const forEachStep=(e,t,a,s)=>{let r=a.value;if(isStale(e,r)){del(e,a);if(!e[n])r=undefined}if(r)t.call(s,r.value,r.key,e)};e.exports=LRUCache},3089:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function _interopDefault(e){return e&&typeof e==="object"&&"default"in e?e["default"]:e}var s=_interopDefault(a(2781));var r=_interopDefault(a(3685));var i=_interopDefault(a(7310));var p=_interopDefault(a(9501));var n=_interopDefault(a(5687));var o=_interopDefault(a(9796));const d=s.Readable;const l=Symbol("buffer");const u=Symbol("type");class Blob{constructor(){this[u]="";const e=arguments[0];const t=arguments[1];const a=[];let s=0;if(e){const t=e;const r=Number(t.length);for(let e=0;e<r;e++){const r=t[e];let i;if(r instanceof Buffer){i=r}else if(ArrayBuffer.isView(r)){i=Buffer.from(r.buffer,r.byteOffset,r.byteLength)}else if(r instanceof Line truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/constants.js","../webpack:/auto-changelog/dist/context.js","../webpack:/auto-changelog/dist/tag.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/@hapi/hoek/lib/applyToDefaults.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/assert.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/clone.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/deepEqual.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/error.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/escapeHtml.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/escapeRegex.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/ignore.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/merge.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/reach.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/stringify.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/types.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/hoek/lib/utils.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@hapi/topo/lib/index.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/@sideway/address/lib/domain.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@sideway/address/lib/email.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@sideway/address/lib/errors.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@sideway/address/lib/ip.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_modules/@sideway/address/lib/tlds.js","../webpack:/auto-changelog/node_modules/.pnpm/@[email protected]/node_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/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:/auto-changelog/node_modules/.pnpm/[email protected]/node_modules/iLine truncated
|
||||
@@ -47,36 +47,6 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@hapi/hoek
|
||||
BSD-3-Clause
|
||||
Copyright (c) 2011-2020, Sideway Inc, and project contributors
|
||||
Copyright (c) 2011-2014, Walmart
|
||||
Copyright (c) 2011, Yahoo Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
@hapi/topo
|
||||
BSD-3-Clause
|
||||
Copyright (c) 2012-2020, Sideway Inc, and project contributors
|
||||
Copyright (c) 2012-2014, Walmart.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
@@ -249,46 +219,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@sideway/address
|
||||
BSD-3-Clause
|
||||
Copyright (c) 2019-2020, Sideway, Inc. and Project contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
@sideway/formula
|
||||
BSD-3-Clause
|
||||
Copyright (c) 2019-2020, Sideway. Inc, and project contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
@sideway/pinpoint
|
||||
BSD-3-Clause
|
||||
Copyright (c) 2019-2020, Sideway. Inc, and project contributors
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
@vercel/ncc
|
||||
MIT
|
||||
Copyright 2018 ZEIT, Inc.
|
||||
@@ -548,21 +478,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
joi
|
||||
BSD-3-Clause
|
||||
Copyright (c) 2012-2022, Project contributors.
|
||||
Copyright (c) 2012-2022, Sideway. Inc.
|
||||
Copyright (c) 2012-2014, Walmart.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
lru-cache
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
extends: ["@commitlint/config-conventional"],
|
||||
rules: {
|
||||
"signed-off-by": [2, "always"],
|
||||
},
|
||||
};
|
||||
+7
-3
@@ -23,11 +23,12 @@
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"prepare": "is-ci || husky install",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "pnpm lint -- --fix",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
"lint:format": "prettier --write src",
|
||||
"build": "tsc",
|
||||
"build:watch": "pnpm build -- --watch",
|
||||
"build:watch": "pnpm build --watch",
|
||||
"package": "ncc build --out action --minify --source-map --license licenses.txt",
|
||||
"all": "pnpm lint:fix && pnpm build && pnpm package",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
@@ -35,12 +36,13 @@
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/github": "^5.1.1",
|
||||
"joi": "^17.9.2",
|
||||
"marked": "^4.3.0",
|
||||
"semver": "^7.5.0",
|
||||
"yaml": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.6.1",
|
||||
"@commitlint/config-conventional": "^17.6.1",
|
||||
"@types/marked": "^4.0.8",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
||||
@@ -50,6 +52,8 @@
|
||||
"eslint-config-noir": "^1.4.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"husky": "^8.0.3",
|
||||
"is-ci": "^3.0.1",
|
||||
"prettier": "^2.8.8",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
|
||||
Generated
+1070
-34
File diff suppressed because it is too large.
Load diff
+119
-82
@@ -23,138 +23,175 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import { debug } from "@actions/core";
|
||||
import {
|
||||
APP_AUTHOR_SUFFIX,
|
||||
APP_AUTHOR_SUFFIX_LENGTH,
|
||||
type ChangelogInputI,
|
||||
COMMIT_REGEX,
|
||||
type LogsI,
|
||||
type ReferenceI,
|
||||
} from "./constants";
|
||||
commitTypes,
|
||||
defaultCommitType,
|
||||
includeCommitLinks,
|
||||
includePRLinks,
|
||||
mentionAuthors,
|
||||
octokit,
|
||||
parseCommitMessage,
|
||||
repository,
|
||||
sha,
|
||||
} from "./utils/index.js";
|
||||
|
||||
function trim(value: string): string {
|
||||
interface TypeGroupI {
|
||||
scopes: ScopeGroupI[];
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface ScopeGroupI {
|
||||
logs: LogI[];
|
||||
scope: string;
|
||||
}
|
||||
|
||||
interface LogI {
|
||||
description: string;
|
||||
references: string[];
|
||||
}
|
||||
|
||||
function trim<T extends string | undefined>(value: T): T {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (value == null) return value;
|
||||
|
||||
return value.trim().replace(/ {2,}/g, " ");
|
||||
return value.trim().replace(/ {2,}/g, " ") as never;
|
||||
}
|
||||
|
||||
function unique(value: string[]): string[] {
|
||||
return [...new Set(value)];
|
||||
}
|
||||
|
||||
export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
const { octokit, owner, repo, sha, tagRef, inputs } = input;
|
||||
const { commitTypes, defaultCommitType, mentionAuthors, includePRLinks, includeCommitLinks } = inputs;
|
||||
function sortBy<T>(array: T[], property: keyof T): T[] {
|
||||
return array.sort((a, b) => (a[property] as string).localeCompare(b[property] as string));
|
||||
}
|
||||
|
||||
const repoUrl = `https://github.com/${ owner }/${ repo }`;
|
||||
const commits: LogsI = {};
|
||||
export async function generateChangelog(lastSha?: string): Promise<string> {
|
||||
const { paginate, rest } = octokit();
|
||||
const { owner, repo, url } = repository();
|
||||
const defaultType = defaultCommitType();
|
||||
const typeMap = commitTypes();
|
||||
|
||||
paginator: for await (const { data } of octokit.paginate.iterator(
|
||||
octokit.rest.repos.listCommits,
|
||||
const iterator = paginate.iterator(
|
||||
rest.repos.listCommits,
|
||||
{
|
||||
per_page: 100,
|
||||
sha : sha(),
|
||||
owner,
|
||||
repo,
|
||||
sha,
|
||||
},
|
||||
)) {
|
||||
);
|
||||
|
||||
const typeGroups: TypeGroupI[] = [];
|
||||
|
||||
paginator: for await (const { data } of iterator) {
|
||||
for (const commit of data) {
|
||||
if (commit.sha === tagRef) break paginator;
|
||||
if (commit.sha === lastSha) break paginator;
|
||||
|
||||
const message = commit.commit.message.split("\n")[0];
|
||||
|
||||
let { type, category, title, pr, flag } = COMMIT_REGEX.exec(message)?.groups ?? {};
|
||||
debug(`commit message -> ${ message }`);
|
||||
|
||||
if (!title) continue;
|
||||
let { type, scope, description, pr, flag } = parseCommitMessage(message);
|
||||
|
||||
if (!description) continue;
|
||||
|
||||
description = trim(description);
|
||||
|
||||
flag = trim(flag);
|
||||
|
||||
if (flag === "ignore") continue;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
type = commitTypes[trim(type)] ?? defaultCommitType;
|
||||
type = typeMap[trim(type ?? "")] ?? defaultType;
|
||||
|
||||
category = category ? trim(category) : "";
|
||||
let typeGroup = typeGroups.find(record => record.type === type);
|
||||
|
||||
title = trim(title);
|
||||
if (typeGroup == null) {
|
||||
typeGroup = {
|
||||
type,
|
||||
scopes: [],
|
||||
};
|
||||
|
||||
let types = commits[type];
|
||||
|
||||
types ??= commits[type] = {};
|
||||
|
||||
let logs = types[category];
|
||||
|
||||
logs ??= types[category] = [];
|
||||
|
||||
const existingCommit = logs.find(log => log.title === title);
|
||||
|
||||
const reference: ReferenceI = {
|
||||
author: mentionAuthors ? commit.author?.login : null,
|
||||
commit: includeCommitLinks ? commit.sha : null,
|
||||
pr : includePRLinks ? pr : null,
|
||||
};
|
||||
|
||||
if (existingCommit == null) {
|
||||
logs.push({
|
||||
title,
|
||||
references: [reference],
|
||||
});
|
||||
} else {
|
||||
existingCommit.references.push(reference);
|
||||
typeGroups.push(typeGroup);
|
||||
}
|
||||
|
||||
scope = trim(scope ?? "");
|
||||
|
||||
let scopeGroup = typeGroup.scopes.find(record => record.scope === scope);
|
||||
|
||||
if (scopeGroup == null) {
|
||||
scopeGroup = {
|
||||
scope,
|
||||
logs: [],
|
||||
};
|
||||
|
||||
typeGroup.scopes.push(scopeGroup);
|
||||
}
|
||||
|
||||
let log = scopeGroup.logs.find(record => record.description === description);
|
||||
|
||||
if (log == null) {
|
||||
log = {
|
||||
description,
|
||||
references: [],
|
||||
};
|
||||
|
||||
scopeGroup.logs.push(log);
|
||||
}
|
||||
|
||||
const reference: string[] = [];
|
||||
|
||||
if (pr && includePRLinks()) reference.push(`${ url }/issues/${ pr }`);
|
||||
|
||||
if (includeCommitLinks()) reference.push(`${ url }/commit/${ commit.sha }`);
|
||||
|
||||
if (commit.author?.login && mentionAuthors()) reference.push(`by @${ commit.author.login }`);
|
||||
|
||||
if (reference.length > 0) log.references.push(reference.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
const TYPES = unique([...Object.values(commitTypes), defaultCommitType]);
|
||||
const types = unique(Object.values(typeMap).concat(defaultType));
|
||||
|
||||
return TYPES.reduce<string[]>((changelog, type) => {
|
||||
const typeGroup = commits[type];
|
||||
const changelog: string[] = [];
|
||||
|
||||
if (typeGroup == null) return changelog;
|
||||
for (const type of types) {
|
||||
const typeGroup = typeGroups.find(log => log.type === type);
|
||||
|
||||
if (typeGroup == null) continue;
|
||||
|
||||
changelog.push(`## ${ type }`);
|
||||
|
||||
const categories = Object.keys(typeGroup).sort();
|
||||
sortBy(typeGroup.scopes, "scope");
|
||||
|
||||
for (const category of categories) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const categoryGroup = typeGroup[category]!;
|
||||
const defaultCategory = category.length === 0;
|
||||
for (const { scope, logs } of typeGroup.scopes) {
|
||||
let prefix = "";
|
||||
|
||||
if (!defaultCategory) changelog.push(`* **${ category }:**`);
|
||||
if (scope.length > 0) {
|
||||
changelog.push(`* **${ scope }:**`);
|
||||
|
||||
const baseLine = defaultCategory ? "" : " ";
|
||||
prefix = " ";
|
||||
}
|
||||
|
||||
for (const { title, references } of categoryGroup) {
|
||||
let log = `${ baseLine }* ${ title }`;
|
||||
for (const { description, references } of logs) {
|
||||
let line = `${ prefix }* ${ description }`;
|
||||
|
||||
const links: string[] = [];
|
||||
if (references.length > 0) line += ` (${ references.join(", ") })`;
|
||||
|
||||
for (const { pr, commit, author } of references) {
|
||||
const link: string[] = [];
|
||||
|
||||
if (pr != null) link.push(`${ repoUrl }/pull/${ pr }`);
|
||||
|
||||
if (commit != null) link.push(`${ repoUrl }/commit/${ commit }`);
|
||||
|
||||
if (author != null) {
|
||||
// eslint-disable-next-line max-depth
|
||||
if (author.endsWith(APP_AUTHOR_SUFFIX)) link.push(`by [@${ author }](https://github.com/apps/${ author.slice(0, -APP_AUTHOR_SUFFIX_LENGTH) })`);
|
||||
else link.push(`by @${ author }`);
|
||||
}
|
||||
|
||||
if (link.length > 0) links.push(link.join(" "));
|
||||
}
|
||||
|
||||
if (links.length > 0) log += ` (${ links.join(", ") })`;
|
||||
|
||||
changelog.push(log);
|
||||
changelog.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
changelog.push("");
|
||||
}
|
||||
|
||||
return changelog;
|
||||
}, []).join("\n");
|
||||
return changelog.join("\n");
|
||||
}
|
||||
|
||||
export interface ChangelogRecordI {
|
||||
description: string;
|
||||
references: string[];
|
||||
scope: string;
|
||||
type: string;
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { type GitHub } from "@actions/github/lib/utils";
|
||||
import { type SemVer } from "semver";
|
||||
|
||||
export const COMMIT_REGEX
|
||||
= /^(?<type>[^:()]*)(?:\((?<category>[^()]*?)\)|): *(?<title>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;
|
||||
|
||||
export const APP_AUTHOR_SUFFIX = "[bot]";
|
||||
|
||||
export const APP_AUTHOR_SUFFIX_LENGTH = APP_AUTHOR_SUFFIX.length;
|
||||
|
||||
export type TypesI = Record<string, string>;
|
||||
|
||||
export type LogsI = Record<string, Record<string, LogI[] | undefined> | undefined>;
|
||||
|
||||
export interface LogI {
|
||||
references: ReferenceI[];
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface ReferenceI {
|
||||
author?: string | null;
|
||||
commit: string | null;
|
||||
pr?: string | null;
|
||||
}
|
||||
|
||||
export interface TagInputI {
|
||||
octokit: InstanceType<typeof GitHub>;
|
||||
owner: string;
|
||||
prerelease: boolean;
|
||||
repo: string;
|
||||
semver: SemVer | null;
|
||||
sha: string;
|
||||
}
|
||||
|
||||
export interface TagResultI {
|
||||
name?: string;
|
||||
sha?: string;
|
||||
}
|
||||
|
||||
export interface ChangelogInputI {
|
||||
inputs: ActionInputsI;
|
||||
octokit: InstanceType<typeof GitHub>;
|
||||
owner: string;
|
||||
repo: string;
|
||||
sha: string;
|
||||
tagRef?: string;
|
||||
}
|
||||
|
||||
export interface ActionInputsI {
|
||||
commitTypes: TypesI;
|
||||
defaultCommitType: string;
|
||||
includeCommitLinks: boolean;
|
||||
includeCompare: boolean;
|
||||
includePRLinks: boolean;
|
||||
mentionAuthors: boolean;
|
||||
mentionNewContributors: boolean;
|
||||
releaseName: string;
|
||||
semver: boolean;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { getBooleanInput, getInput } from "@actions/core";
|
||||
import Joi from "joi";
|
||||
import YAML from "yaml";
|
||||
import { type ActionInputsI, type TypesI } from "./constants";
|
||||
|
||||
export function getToken(): string {
|
||||
return getInput("github-token", { required: true });
|
||||
}
|
||||
|
||||
export async function getInputs(): Promise<ActionInputsI> {
|
||||
const commitTypes = YAML.parse(getInput("commit-types", { required: true }));
|
||||
const defaultCommitType = getInput("default-commit-type", { required: true });
|
||||
const releaseName = getInput("release-name", { required: true });
|
||||
const mentionAuthors = getBooleanInput("mention-authors", { required: true });
|
||||
const mentionNewContributors = getBooleanInput("mention-new-contributors", {
|
||||
required: true,
|
||||
});
|
||||
const includeCompare = getBooleanInput("include-compare", { required: true });
|
||||
const includePRLinks = getBooleanInput("include-pr-links", { required: true });
|
||||
const includeCommitLinks = getBooleanInput("include-commit-links", { required: true });
|
||||
const semver = getBooleanInput("semver", { required: true });
|
||||
|
||||
return Joi.object<ActionInputsI, true>()
|
||||
.keys({
|
||||
commitTypes: Joi.object<TypesI>()
|
||||
.pattern(Joi.string(), Joi.string())
|
||||
.required(),
|
||||
defaultCommitType : Joi.string().required(),
|
||||
releaseName : Joi.string().required(),
|
||||
mentionAuthors : Joi.boolean().required(),
|
||||
mentionNewContributors: Joi.boolean().required(),
|
||||
includeCompare : Joi.boolean().required(),
|
||||
includePRLinks : Joi.boolean().required(),
|
||||
includeCommitLinks : Joi.boolean().required(),
|
||||
semver : Joi.boolean().required(),
|
||||
})
|
||||
.validateAsync({
|
||||
commitTypes,
|
||||
defaultCommitType,
|
||||
releaseName,
|
||||
mentionAuthors,
|
||||
mentionNewContributors,
|
||||
includeCompare,
|
||||
includePRLinks,
|
||||
includeCommitLinks,
|
||||
semver,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { marked } from "marked";
|
||||
import { includeCompareLink, mentionNewContributors, octokit, releaseName, repository } from "./utils/index.js";
|
||||
|
||||
export async function generateFooter(previousTagName?: string): Promise<string> {
|
||||
const { owner, repo, url } = repository();
|
||||
const tagName = releaseName();
|
||||
|
||||
const footer: string[] = [];
|
||||
|
||||
|
||||
if (mentionNewContributors()) {
|
||||
const { rest } = octokit();
|
||||
|
||||
const { data } = await rest.repos.generateReleaseNotes({
|
||||
owner,
|
||||
repo,
|
||||
tag_name : tagName,
|
||||
previous_tag_name: previousTagName,
|
||||
});
|
||||
|
||||
const tokens = marked.lexer(data.body);
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
const index = tokens.findIndex(markdownToken => markdownToken.type === "heading" && markdownToken.text === "New Contributors");
|
||||
|
||||
const markdownToken = tokens[index + 1];
|
||||
|
||||
if (markdownToken.type === "list") footer.push(`## New Contributors\n${ markdownToken.raw }\n`);
|
||||
}
|
||||
|
||||
if (includeCompareLink() && previousTagName) footer.push(`**Full Changelog**: ${ url }/compare/${ previousTagName }...${ tagName }`);
|
||||
|
||||
if (footer.length > 0) footer.unshift("");
|
||||
|
||||
return footer.join("\n\n");
|
||||
}
|
||||
+11
-82
@@ -23,95 +23,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import { info, setFailed, setOutput } from "@actions/core";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import { marked } from "marked";
|
||||
import { parse as parseSemVer, type SemVer } from "semver";
|
||||
import { generate } from "./changelog.js";
|
||||
import { getInputs, getToken } from "./context.js";
|
||||
import { getTagSha } from "./tag.js";
|
||||
import { setFailed } from "@actions/core";
|
||||
import { generateChangelog } from "./changelog.js";
|
||||
import { generateFooter } from "./footer.js";
|
||||
import { getTagInfo } from "./tag.js";
|
||||
import { setChangelog, setPrerelease, setReleaseId } from "./utils/index.js";
|
||||
|
||||
async function run(): Promise<void> {
|
||||
const inputs = await getInputs();
|
||||
const { prerelease, releaseId, previous } = await getTagInfo();
|
||||
|
||||
const octokit = getOctokit(getToken());
|
||||
setPrerelease(prerelease);
|
||||
|
||||
const {
|
||||
repo: { owner, repo },
|
||||
sha,
|
||||
} = context;
|
||||
setReleaseId(releaseId);
|
||||
|
||||
let semver: SemVer | null = null;
|
||||
let changelog = await generateChangelog(previous?.sha);
|
||||
|
||||
if (inputs.semver) {
|
||||
semver = parseSemVer(inputs.releaseName, {
|
||||
includePrerelease: true,
|
||||
} as never);
|
||||
changelog += await generateFooter(previous?.name);
|
||||
|
||||
if (semver == null) {
|
||||
setFailed(`Expected a semver compatible releaseName, got "${ inputs.releaseName }" instead.`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let prerelease = false;
|
||||
let releaseId = "latest";
|
||||
|
||||
if (semver != null) {
|
||||
prerelease = semver.prerelease.length > 0;
|
||||
|
||||
if (prerelease) releaseId = semver.prerelease[0] as string;
|
||||
}
|
||||
|
||||
const { sha: tagRef, name: tagName } = await getTagSha({
|
||||
octokit,
|
||||
owner,
|
||||
repo,
|
||||
sha,
|
||||
semver,
|
||||
prerelease,
|
||||
});
|
||||
|
||||
let changelog = await generate({
|
||||
octokit,
|
||||
owner,
|
||||
repo,
|
||||
sha,
|
||||
tagRef,
|
||||
inputs,
|
||||
});
|
||||
|
||||
if (inputs.mentionNewContributors) {
|
||||
const { data } = await octokit.rest.repos.generateReleaseNotes({
|
||||
owner,
|
||||
repo,
|
||||
tag_name : inputs.releaseName,
|
||||
previous_tag_name: tagName,
|
||||
});
|
||||
|
||||
const tokens = marked.lexer(data.body);
|
||||
|
||||
const index = tokens.findIndex(token => token.type === "heading" && token.text === "New Contributors");
|
||||
|
||||
const token = tokens[index + 1];
|
||||
|
||||
if (token.type === "list") changelog += `\n\n## New Contributors\n${ token.raw }\n`;
|
||||
}
|
||||
|
||||
if (inputs.includeCompare && tagName != null) changelog += `\n\n**Full Changelog**: https://github.com/${ owner }/${ repo }/compare/${ tagName }...${ inputs.releaseName }`;
|
||||
|
||||
info(`-> prerelease: ${ prerelease }`);
|
||||
|
||||
setOutput("prerelease", prerelease);
|
||||
|
||||
info(`-> release-id: ${ releaseId }`);
|
||||
|
||||
setOutput("release-id", releaseId);
|
||||
|
||||
info(`-> changelog: "${ changelog }"`);
|
||||
|
||||
setOutput("changelog", changelog);
|
||||
setChangelog(changelog);
|
||||
}
|
||||
|
||||
run().catch(setFailed);
|
||||
+53
-21
@@ -23,45 +23,77 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import { parse as parseSemVer } from "semver";
|
||||
import { type TagInputI, type TagResultI } from "./constants.js";
|
||||
import { type SemVer } from "semver";
|
||||
import { octokit, parseSemVer, releaseName, repository, semver, sha } from "./utils/index.js";
|
||||
|
||||
export async function getTagSha(input: TagInputI): Promise<TagResultI> {
|
||||
const { octokit, owner, repo, sha, semver, prerelease } = input;
|
||||
export interface TagInfoI {
|
||||
prerelease: boolean;
|
||||
|
||||
for await (const { data } of octokit.paginate.iterator(
|
||||
octokit.rest.repos.listTags,
|
||||
previous?: {
|
||||
name: string;
|
||||
sha: string;
|
||||
};
|
||||
|
||||
releaseId: string;
|
||||
}
|
||||
|
||||
export async function getTagInfo(): Promise<TagInfoI> {
|
||||
const { paginate, rest } = octokit();
|
||||
const { owner, repo } = repository();
|
||||
|
||||
const info: TagInfoI = {
|
||||
releaseId : "latest",
|
||||
prerelease: false,
|
||||
};
|
||||
|
||||
let semVer: SemVer | null = null;
|
||||
|
||||
if (semver()) {
|
||||
semVer = parseSemVer();
|
||||
|
||||
if (semVer == null) throw new Error(`Expected a semver compatible releaseName, got "${ releaseName() }" instead.`);
|
||||
|
||||
info.prerelease = semVer.prerelease.length > 0;
|
||||
|
||||
if (info.prerelease) info.releaseId = `${ semVer.prerelease[0] }`;
|
||||
}
|
||||
|
||||
const iterator = paginate.iterator(
|
||||
rest.repos.listTags,
|
||||
{
|
||||
per_page: 100,
|
||||
owner,
|
||||
repo,
|
||||
},
|
||||
)) {
|
||||
for (const {
|
||||
name,
|
||||
commit: { sha: tagSha },
|
||||
} of data) {
|
||||
if (sha === tagSha) continue;
|
||||
);
|
||||
|
||||
if (semver == null) {
|
||||
return {
|
||||
sha: tagSha,
|
||||
loop: for await (const { data } of iterator) {
|
||||
for (const { name, commit } of data) {
|
||||
if (sha() === commit.sha) continue;
|
||||
|
||||
if (semVer == null) {
|
||||
info.previous = {
|
||||
name,
|
||||
sha: commit.sha,
|
||||
};
|
||||
|
||||
break loop;
|
||||
}
|
||||
|
||||
const tagSemver = parseSemVer(name, { includePrerelease: true } as never);
|
||||
const version = parseSemVer(name);
|
||||
|
||||
if (tagSemver == null || semver.compare(tagSemver) <= 0) continue;
|
||||
if (version == null || semVer.compare(version) <= 0) continue;
|
||||
|
||||
if (tagSemver.prerelease.length > 0 && !prerelease) continue;
|
||||
if (version.prerelease.length > 0 && !info.prerelease) continue;
|
||||
|
||||
return {
|
||||
sha: tagSha,
|
||||
info.previous = {
|
||||
name,
|
||||
sha: commit.sha,
|
||||
};
|
||||
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
return info;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { getBooleanInput } from "@actions/core";
|
||||
import { cache } from "./cache.js";
|
||||
|
||||
export function booleanInput(
|
||||
name: string,
|
||||
required = true,
|
||||
): boolean {
|
||||
return cache(name, () => getBooleanInput(name, { required }));
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
const CACHE = (new Map);
|
||||
|
||||
export function cache<T>(key: string, value: () => T, overwrite = false): T {
|
||||
if (!CACHE.has(key) || overwrite) CACHE.set(key, value());
|
||||
|
||||
return CACHE.get(key);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
export * from "./inputs/index.js";
|
||||
export * from "./outputs/index.js";
|
||||
export * from "./boolean-input.js";
|
||||
export * from "./cache.js";
|
||||
export * from "./input.js";
|
||||
export * from "./octokit.js";
|
||||
export * from "./output.js";
|
||||
export * from "./parse-commit-message.js";
|
||||
export * from "./parse-semver.js";
|
||||
export * from "./repository.js";
|
||||
export * from "./sha.js";
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { getInput } from "@actions/core";
|
||||
import { cache } from "./cache.js";
|
||||
|
||||
export function input<T = string>(
|
||||
name: string,
|
||||
parser: (value: string) => T = (value): T => value as T,
|
||||
required = true,
|
||||
): T {
|
||||
return cache(name, () => parser(getInput(name, { required })));
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import YAML from "yaml";
|
||||
import { input } from "../input.js";
|
||||
|
||||
export function commitTypes(): Record<string, string> {
|
||||
return input("commit-types", value => YAML.parse(value));
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { input } from "../input.js";
|
||||
|
||||
export function defaultCommitType(): string {
|
||||
return input("default-commit-type");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { booleanInput } from "../boolean-input.js";
|
||||
|
||||
export function includeCommitLinks(): boolean {
|
||||
return booleanInput("include-commit-links");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { booleanInput } from "../boolean-input.js";
|
||||
|
||||
export function includeCompareLink(): boolean {
|
||||
return booleanInput("include-compare");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { booleanInput } from "../boolean-input.js";
|
||||
|
||||
export function includePRLinks(): boolean {
|
||||
return booleanInput("include-pr-links");
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
export * from "./commit-types.js";
|
||||
export * from "./default-commit-type.js";
|
||||
export * from "./include-compare-link.js";
|
||||
export * from "./include-commit-links.js";
|
||||
export * from "./include-pr-links.js";
|
||||
export * from "./mention-authors.js";
|
||||
export * from "./mention-new-contributors.js";
|
||||
export * from "./release-name.js";
|
||||
export * from "./semver.js";
|
||||
export * from "./token.js";
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { booleanInput } from "../boolean-input.js";
|
||||
|
||||
export function mentionAuthors(): boolean {
|
||||
return booleanInput("mention-authors");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { booleanInput } from "../boolean-input.js";
|
||||
|
||||
export function mentionNewContributors(): boolean {
|
||||
return booleanInput("mention-new-contributors");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { input } from "../input.js";
|
||||
|
||||
export function releaseName(): string {
|
||||
return input("release-name");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { booleanInput } from "../boolean-input.js";
|
||||
|
||||
export function semver(): boolean {
|
||||
return booleanInput("semver");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { input } from "../input.js";
|
||||
|
||||
export function token(): string {
|
||||
return input("github-token");
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { getOctokit } from "@actions/github";
|
||||
import { type GitHub } from "@actions/github/lib/utils.js";
|
||||
import { cache } from "./cache.js";
|
||||
import { token } from "./inputs/index.js";
|
||||
|
||||
export function octokit(): InstanceType<typeof GitHub> {
|
||||
return cache("octokit", () => getOctokit(token()));
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { info, setOutput } from "@actions/core";
|
||||
|
||||
export function output(name: string, value: unknown): void {
|
||||
info(`output -> ${ name }: ${ value }`);
|
||||
|
||||
setOutput(name, value);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
export * from "./set-changelog.js";
|
||||
export * from "./set-prerelease.js";
|
||||
export * from "./set-release-id.js";
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { output } from "../output.js";
|
||||
|
||||
export function setChangelog(changelog: string): void {
|
||||
output("changelog", changelog);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { output } from "../output.js";
|
||||
|
||||
export function setPrerelease(prerelease: boolean): void {
|
||||
output("prerelease", prerelease);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { output } from "../output.js";
|
||||
|
||||
export function setReleaseId(releaseId: string): void {
|
||||
output("release-id", releaseId);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
const REGEX = /^(?<type>[^:()]*)(?:\((?<scope>[^()]*?)\)|): *(?<description>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;
|
||||
|
||||
export function parseCommitMessage(message: string): { description?: string; flag?: string; pr?: `${ number }`; scope?: string; type?: string } {
|
||||
return REGEX.exec(message)?.groups ?? {};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { parse, type SemVer } from "semver";
|
||||
import { cache } from "./cache.js";
|
||||
import { releaseName } from "./inputs/index.js";
|
||||
|
||||
export function parseSemVer(version = releaseName()): SemVer | null {
|
||||
return cache(`semver-${ version }`, () => parse(version, { includePrerelease: true } as never));
|
||||
}
|
||||
|
||||
export { SemVer };
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { context } from "@actions/github";
|
||||
import { cache } from "./cache.js";
|
||||
|
||||
export function repository(): { owner: string; repo: string; url: string } {
|
||||
return cache("repo", () => {
|
||||
const { repo: { owner, repo }, serverUrl } = context;
|
||||
|
||||
return {
|
||||
owner,
|
||||
repo,
|
||||
url: `${ serverUrl }/${ owner }/${ repo }`,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { context } from "@actions/github";
|
||||
import { cache } from "./cache.js";
|
||||
|
||||
export function sha(): string {
|
||||
return cache("sha", () => context.sha);
|
||||
}
|
||||
Reference in new issue
Block a user