feat: Add semantic versioning compatibility (#47)

* feat: Use regex groups

* feat: Add semver input

* deps: Add semver v7.3.7

* deps(Dev): Add @types/semver v7.3.9

* feat: Add prerelease output

* chore: Update action directory

* feat: Log prerelease value

* ci(GitHub): Update release workflow

* docs: Update README.md

* feat: Add ability to detect previous version based on semver comparison

* ci(GitHub): fix test workflow
This commit is contained in:
Ardalan Amini authored and GitHub committed 2022-04-29 00:06:26 +04:30
1 parent de993f2bea
commit bd78d66436
16 files changed
+226 -53

No files matched your search

+2 -1
View File
@@ -16,7 +16,7 @@ jobs:
environment:
name: release
url: https://github.com/ardalanamini/auto-changelog/releases
url: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
runs-on: ubuntu-latest
@@ -37,3 +37,4 @@ jobs:
with:
body: |
${{ steps.changelog.outputs.changelog }}
prerelease: ${{ steps.changelog.outputs.prerelease }}
+3
View File
@@ -49,6 +49,8 @@ jobs:
- name: Changelog
uses: ./
with:
semver: ${{ github.event_name == 'workflow_call' }}
test-with-inputes: # make sure the action works on a clean machine without building
name: Test with inputs
@@ -65,3 +67,4 @@ jobs:
commit-types: |
feat: Feature
default-commit-type: Default Type
semver: ${{ github.event_name == 'workflow_call' }}
+29
View File
@@ -11,8 +11,10 @@ Automatic Changelog generator
- [Github Token](#github-token)
- [Commit Types](#commit-types)
- [Default Commit Type](#default-commit-type)
- [SemVer Compatibility](#semver)
- [Outputs](#outputs)
- [Changelog](#changelog)
- [Pre-release](#prerelease)
- [Example Usage](#example-usage)
## Usage
@@ -92,12 +94,38 @@ _Default:_
Other Changes
```
#### `semver`
**(Optional)**
Enable semver based version comparison.
If enabled it'll determine whether the github ref is a valid semver string,
it'll fail the action in case it's not.
It'll then determine whether the version is a pre-release or not,
if it is, the previous version will be selected from any version (pre-release or not) lesser than the current ref,
if current ref is not a pre-release,
the previous version will be selected only from the latest version (not pre-release) lesser than the current ref.
_Default:_
```yaml
true
```
### Outputs
#### `changelog`
The generated changelog.
#### `prerelease`
Indicates whether it's a pre-release or not.
> if semver is set to `true`, otherwise this output will always return `false`.
### Example Usage
Using with default inputs:
@@ -132,4 +160,5 @@ Using with custom inputs:
chore: Chores
other: Other Changes
default-commit-type: Other Changes
semver: true
```
+20 -12
View File
@@ -1,22 +1,22 @@
name: 'Auto Changelog'
name: Auto Changelog
description: 'Automatic Changelog generator'
description: Automatic Changelog generator
author: 'Ardalan Amini'
author: Ardalan Amini
branding:
icon: 'clock'
color: 'blue'
icon: clock
color: blue
inputs:
github-token:
description: 'Github token'
description: Github token
required: true
default: ${{ github.token }}
commit-types:
description: 'Commit types'
description: Commit types
required: true
default: |
breaking: Breaking Changes
@@ -35,15 +35,23 @@ inputs:
other: Other Changes
default-commit-type:
description: 'Default commit type to be used when the commit message matches none of the defined types'
description: Default commit type to be used when the commit message matches none of the defined types
required: true
default: 'Other Changes'
default: Other Changes
semver:
description: Enable semver based version comparison
required: true
default: 'true'
outputs:
changelog:
description: 'The generated changelogs'
description: The generated changelogs
prerelease:
description: Indicates whether it's a pre-release or not (if semver is set to true, otherwise this output will always return false)
runs:
using: 'node16'
main: 'action/index.js'
using: node16
main: action/index.js
+2 -2
View File
@@ -1,8 +1,8 @@
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:function(e,t,a){"use strict";var s=this&&this.__awaiter||function(e,t,a,s){function adopt(e){return e instanceof a?e:new a((function(t){t(e)}))}return new(a||(a=Promise))((function(a,r){function fulfilled(e){try{step(s.next(e))}catch(e){r(e)}}function rejected(e){try{step(s["throw"](e))}catch(e){r(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())}))};var r=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],a;return t?t.call(e):(e=typeof __values==="function"?__values(e):e[Symbol.iterator](),a={},verb("next"),verb("throw"),verb("return"),a[Symbol.asyncIterator]=function(){return this},a);function verb(t){a[t]=e[t]&&function(a){return new Promise((function(s,r){a=e[t](a),settle(s,r,a.done,a.value)}))}}function settle(e,t,a,s){Promise.resolve(s).then((function(t){e({value:t,done:a})}),t)}};var i=this&&this.__rest||function(e,t){var a={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0)a[s]=e[s];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++){if(t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r]))a[s[r]]=e[s[r]]}return a};Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;const n=a(1912);function generate(e){var t,a;var o,p,d;return s(this,void 0,void 0,(function*(){const{octokit:s,owner:l,repo:m,sha:c,tagRef:u,inputs:h}=e;const{commitTypes:g,defaultCommitType:v}=h;const y=`https://github.com/${l}/${m}`;const b={};try{e:for(var w=r(s.paginate.iterator(s.rest.repos.listCommits,{per_page:100,owner:l,repo:m,sha:c})),_;_=yield w.next(),!_.done;){const{data:e}=_.value;for(let t of e){const{sha:e}=t,a=i(t,["sha"]);if(e===u)break e;const s=a.commit.message.split("\n")[0];let[,r,l,m,c]=n.COMMIT_REGEX.exec(s)||[];if(!m)continue;c=trim(c);if(c==="ignore")continue;r=trim(r);r=(o=g[r])!==null&&o!==void 0?o:v;l=l?trim(l):"";m=trim(m).replace(n.PR_REGEX,((e,t)=>`[${e}](${y}/pull/${t})`));b[r]=(p=b[r])!==null&&p!==void 0?p:{};b[r][l]=(d=b[r][l])!==null&&d!==void 0?d:[];const h=b[r][l].findIndex((e=>e.title===m));if(h===-1)b[r][l].push({title:m,commits:[e]});else b[r][l][h].commits.push(e)}}}catch(e){t={error:e}}finally{try{if(_&&!_.done&&(a=w.return))yield a.call(w)}finally{if(t)throw t.error}}const E=unique([...Object.values(g),v]);return E.reduce(((e,t)=>{const a=b[t];if(a==null)return e;e.push(`### ${t}`,"");const s=Object.keys(a).sort();for(const t of s){const s=a[t];const r=t.length===0;if(!r)e.push(`* **${t}:**`);const i=r?"":" ";for(const{title:t,commits:a}of s){e.push(`${i}* ${t} (${a.map((e=>`[${e.slice(0,8)}](${y}/commit/${e})`)).join(",")})`)}}e.push("");return e}),[]).join("\n")}))}t.generate=generate;function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}},1912:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.PR_REGEX=t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^([^)]*)(?:\(([^)]*?)\)|):(.*?)(?:\[([^\]]+?)\]|)\s*$/;t.PR_REGEX=/#([1-9]\d*)/g},7331:function(e,t,a){"use strict";var s=this&&this.__awaiter||function(e,t,a,s){function adopt(e){return e instanceof a?e:new a((function(t){t(e)}))}return new(a||(a=Promise))((function(a,r){function fulfilled(e){try{step(s.next(e))}catch(e){r(e)}}function rejected(e){try{step(s["throw"](e))}catch(e){r(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())}))};var r=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 i=a(2186);const n=r(a(918));const o=r(a(4083));function getToken(){return(0,i.getInput)("github-token",{required:true})}t.getToken=getToken;function getInputs(){return s(this,void 0,void 0,(function*(){const e=o.default.parse((0,i.getInput)("commit-types",{required:true}));const t=(0,i.getInput)("default-commit-type",{required:true});return n.default.object().keys({commitTypes:n.default.object().pattern(n.default.string(),n.default.string()).required(),defaultCommitType:n.default.string().required()}).validateAsync({commitTypes:e,defaultCommitType:t})}))}t.getInputs=getInputs},9283:function(e,t,a){"use strict";var s=this&&this.__awaiter||function(e,t,a,s){function adopt(e){return e instanceof a?e:new a((function(t){t(e)}))}return new(a||(a=Promise))((function(a,r){function fulfilled(e){try{step(s.next(e))}catch(e){r(e)}}function rejected(e){try{step(s["throw"](e))}catch(e){r(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});const r=a(2186);const i=a(5438);const n=a(7412);const o=a(7331);function run(){return s(this,void 0,void 0,(fuLine truncated
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;const a=s(1912);async function generate(e){const{octokit:t,owner:s,repo:r,sha:i,tagRef:n,inputs:o}=e;const{commitTypes:p,defaultCommitType:l}=o;const d=`https://github.com/${s}/${r}`;const c={};e:for await(const{data:e}of t.paginate.iterator(t.rest.repos.listCommits,{per_page:100,owner:s,repo:r,sha:i})){for(const{sha:t,...s}of e){if(t===n)break e;const e=s.commit.message.split("\n")[0];let{type:r,category:i,title:o,flag:m}=a.COMMIT_REGEX.exec(e)?.groups??{};if(!o)continue;m=trim(m);if(m==="ignore")continue;r=trim(r);r=p[r]??l;i=i?trim(i):"";o=trim(o).replace(a.PR_REGEX,((e,t)=>`[${e}](${d}/pull/${t})`));c[r]=c[r]??{};c[r][i]=c[r][i]??[];const u=c[r][i].findIndex((e=>e.title===o));if(u===-1)c[r][i].push({title:o,commits:[t]});else c[r][i][u].commits.push(t)}}const m=unique([...Object.values(p),l]);return m.reduce(((e,t)=>{const s=c[t];if(s==null)return e;e.push(`### ${t}`,"");const a=Object.keys(s).sort();for(const t of a){const a=s[t];const r=t.length===0;if(!r)e.push(`* **${t}:**`);const i=r?"":" ";for(const{title:t,commits:s}of a){e.push(`${i}* ${t} (${s.map((e=>`[${e.slice(0,8)}](${d}/commit/${e})`)).join(",")})`)}}e.push("");return e}),[]).join("\n")}t.generate=generate;function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}},1912:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.PR_REGEX=t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^(?<type>[^)]*)(?:\((?<category>[^)]*?)\)|):(?<title>.*?)(?:\[(?<flag>[^\]]+?)\]|)\s*$/;t.PR_REGEX=/#([1-9]\d*)/g},7331:function(e,t,s){"use strict";var a=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 r=s(2186);const i=a(s(918));const n=a(s(4083));function getToken(){return(0,r.getInput)("github-token",{required:true})}t.getToken=getToken;async function getInputs(){const e=n.default.parse((0,r.getInput)("commit-types",{required:true}));const t=(0,r.getInput)("default-commit-type",{required:true});const s=(0,r.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(),semver:i.default.boolean().required()}).validateAsync({commitTypes:e,defaultCommitType:t,semver:s})}t.getInputs=getInputs},9283:function(e,t,s){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const r=s(2186);const i=s(5438);const n=a(s(1383));const o=s(9297);const p=s(7412);const l=s(7331);async function run(){const e=await(0,l.getInputs)();const t=(0,i.getOctokit)((0,l.getToken)());const{repo:{owner:s,repo:a},sha:d,ref:c}=i.context;let m=null;if(e.semver){m=n.default.parse(c,{includePrerelease:true});if(m==null)return(0,r.setFailed)(`Expected a semver compatible ref, got "${c}" instead.`)}let u=false;if(m!=null)u=m.prerelease.length>0;const h=await(0,o.getTagSha)({octokit:t,owner:s,repo:a,sha:d,semver:m,prerelease:u});const g=await(0,p.generate)({octokit:t,owner:s,repo:a,sha:d,tagRef:h,inputs:e});(0,r.info)(g);(0,r.setOutput)("changelog",g);(0,r.info)(`prerelease: ${u}`);(0,r.setOutput)("prerelease",u)}run().catch(r.setFailed)},9297:function(e,t,s){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getTagSha=void 0;const r=a(s(1383));async function getTagSha(e){const{octokit:t,owner:s,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:s,repo:a})){for(const{name:t,commit:{sha:s}}of e){if(i===s)continue;if(n==null)return s;const e=r.default.parse(t,{includePrerelease:true});if(e==null||n.compare(e)<=0)continue;if(e.prerelease.length>0&&!o)continue;return s}}return undefined}t.getTagSha=getTagSha},7351:function(e,t,s){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,s,a){if(a===undefined)a=s;Object.defineProperty(e,a,{enumerable:true,get:function(){return t[s]}})}:function(e,t,s,a){if(a===undefined)a=s;e[a]=t[s]});var r=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 s in e)if(s!=="default"&&Object.hasOwnProperty.call(e,s))a(t,e,s);r(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issue=t.issueCommand=void 0;const n=i(s(2037));const o=s(5278);function issueCommand(e,t,s){const a=new Command(e,t,s);process.stdout.write(a.toString()+n.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCoLine 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,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},6014:(e,t,a)=>{"use strict";const s=a(5578);const r=a(2448);const i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||typeof this._original!=="object"){return this.details[0].message}const t=e?"":"";const a=e?"":"";const n=e?"":"";const o=s(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1;const a=this.details[e];const s=a.path;let n=o;for(let e=0;;++e){const o=s[e];if(r.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||a.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 d=i.safeStringify(o,2).replace(p.key,((e,a)=>`" ${t}[${a}]${n}`)).replace(p.missing,((e,s,r)=>`${a}"${s}"${n}${t} [${r}]: -- missing --${n}`)).replace(p.arrayIndex,((e,a,s)=>`\n${s} ${t}[${a}]${n}`)).replace(p.specials,((e,t)=>t));d=`${d}\n${t}`;for(let e=0;e<this.details.length;++e){const t=e+1;d=`${d}\n[${t}] ${this.details[e].message}`}d=d+n;return d};i.safeStringify=function(e,t){return JSON.stringify(e,i.serializer(),t)};i.serializer=function(){const e=[];const t=[];const cycleReplacer=(a,s)=>{if(t[0]===s){return"[Circular ~]"}return"[Circular ~."+e.slice(0,t.indexOf(s)).join(".")+"]"};return function(a,s){if(t.length>0){const r=t.indexOf(this);if(~r){t.length=r+1;e.length=r+1;e[r]=a}else{t.push(this);e.push(a)}if(~t.indexOf(s)){s=cycleReplacer.call(this,a,s)}}else{t.push(s)}if(s){const e=s[i.annotations];if(e){if(Array.isArray(s)){const t=[];for(let a=0;a<s.length;++a){if(e.errors[a]){t.push(`_$idx$_${e.errors[a].sort().join(", ")}_$end$_`)}t.push(s[a])}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}}},5184:(e,t,a)=>{"use strict";const s=a(2718);const r=a(5578);const i=a(5801);const n=a(445);const o=a(3355);const p=a(2448);const d=a(3038);const l=a(9490);const m=a(6680);const c=a(7997);const u=a(6103);const h=a(1290);const g=a(3838);const v=a(3171);const y=a(1804);const b=a(1944);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 a in e){const r=e[a];s(typeof r==="function","Alteration adjuster for",a,"must be a function");t.$_terms.alterations.push({target:a,adjuster:r})}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");returLine truncated
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,s;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;s=t.prototype;if(isObject(s)===false)return false;if(s.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},6014:(e,t,s)=>{"use strict";const a=s(5578);const r=s(2448);const i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||typeof this._original!=="object"){return this.details[0].message}const t=e?"":"";const s=e?"":"";const n=e?"":"";const o=a(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1;const s=this.details[e];const a=s.path;let n=o;for(let e=0;;++e){const o=a[e];if(r.isSchema(n)){n=n.clone()}if(e+1<a.length&&typeof n[o]!=="string"){n=n[o]}else{const e=n[i.annotations]||{errors:{},missing:{}};n[i.annotations]=e;const a=o||s.context.key;if(n[o]!==undefined){e.errors[a]=e.errors[a]||[];e.errors[a].push(t)}else{e.missing[a]=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,s)=>`" ${t}[${s}]${n}`)).replace(p.missing,((e,a,r)=>`${s}"${a}"${n}${t} [${r}]: -- missing --${n}`)).replace(p.arrayIndex,((e,s,a)=>`\n${a} ${t}[${s}]${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=(s,a)=>{if(t[0]===a){return"[Circular ~]"}return"[Circular ~."+e.slice(0,t.indexOf(a)).join(".")+"]"};return function(s,a){if(t.length>0){const r=t.indexOf(this);if(~r){t.length=r+1;e.length=r+1;e[r]=s}else{t.push(this);e.push(s)}if(~t.indexOf(a)){a=cycleReplacer.call(this,s,a)}}else{t.push(a)}if(a){const e=a[i.annotations];if(e){if(Array.isArray(a)){const t=[];for(let s=0;s<a.length;++s){if(e.errors[s]){t.push(`_$idx$_${e.errors[s].sort().join(", ")}_$end$_`)}t.push(a[s])}a=t}else{for(const t in e.errors){a[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=a[t];a[t]=undefined}for(const t in e.missing){a[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}}return a}}if(a===Infinity||a===-Infinity||Number.isNaN(a)||typeof a==="function"||typeof a==="symbol"){return"["+a.toString()+"]"}return a}}},5184:(e,t,s)=>{"use strict";const a=s(2718);const r=s(5578);const i=s(5801);const n=s(445);const o=s(3355);const p=s(2448);const l=s(3038);const d=s(9490);const c=s(6680);const m=s(7997);const u=s(6103);const h=s(1290);const g=s(3838);const v=s(3171);const y=s(1804);const w=s(1944);const b={};b.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(){a(typeof m.describe==="function","Manifest functionality disabled");return m.describe(this)}allow(...e){p.verifyFlat(e,"allow");return this._values(e,"_valids")}alter(e){a(e&&typeof e==="object"&&!Array.isArray(e),"Invalid targets argument");a(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const s in e){const r=e[s];a(typeof r==="function","Alteration adjuster for",s,"must be a function");t.$_terms.alterations.push({target:s,adjuster:r})}t.$_temp.ruleset=false;return t}artifact(e){a(e!==undefined,"Artifact cannot be undefined");a(!this._cache,"Cannot set an artifact with a rule cache");return this.$_setFlag("artifact",e)}cast(e){a(e===false||typeof e==="string","Invalid to value");a(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){a(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){a(e,"Missing error");a(e instanceof Error||typeof e==="function","Must provide a valid Error object or a function");return this.$_setFlag("error",e)}example(e,t={}){a(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"){a(!t,"Cannot combine options with description");t=e.description;e=e.method}a(typeof e==="function","Method must be a function");a(t===undefined||t&&typeof t==="string","Description must be a non-empty string");returLine truncated
//# sourceMappingURL=index.js.map
+1 -1
View File
@@ -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/index.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/http-client/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/proxy.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/applyToDefaults.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/assert.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/clone.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/deepEqual.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/error.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeHtml.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeRegex.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/ignore.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/merge.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/reach.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/stringify.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/types.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/utils.js","../webpack:/auto-changelog/node_modules/@hapi/topo/lib/index.js","../webpack:/auto-changelog/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/domain.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/email.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/errors.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/ip.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/tlds.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/uri.js","../webpack:/auto-changelog/node_modules/@sideway/formula/lib/index.js","../webpack:/auto-changelog/node_modules/@sideway/pinpoint/lib/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/deprecation/dist-node/index.js","../webpack:/auto-changelog/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/auto-changelog/node_modules/joi/lib/annotate.js","../webpack:/auto-changelog/node_modules/joi/lib/base.js","../webpack:/auto-changelog/node_modules/joi/lib/cache.js","../webpack:/auto-changelog/node_modules/joi/lib/common.js","../webpack:/auto-changelog/node_modules/joi/lib/compile.js","../webpack:/auto-changelog/node_modules/joi/lib/errors.js","../webpack:/auto-changelog/node_modules/joi/lib/extend.js","../webpack:/auto-changelog/node_modules/joi/lib/index.js","../webpack:/auto-changelog/node_modules/joi/lib/manifest.js","../webpack:/auto-changelog/node_modules/joi/lib/messages.js","../webpack:/auto-changelog/node_modules/joi/lib/modify.js","../webpack:/auto-changelog/node_modules/joi/lib/ref.js","../webpack:/auto-changelog/node_modules/joi/lib/schemas.js","../webpack:/auto-changelog/node_modules/joi/lib/state.js","../webpack:/auto-changelog/node_modules/joi/lib/template.js","../webpack:/auto-changelog/node_modules/joi/lib/trace.js","../webpack:/auto-changelog/node_modules/joi/lib/types/alternatives.js","../webpack:/auto-changelog/node_modules/joi/lib/types/any.js","../webpack:/auto-changelog/node_modules/joi/lib/types/array.js","../webpack:/auto-changelog/node_modules/joi/lib/types/binary.js","../webpack:/auto-changelog/node_modules/joi/lib/types/boolLine truncated
{"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/index.js","../webpack:/auto-changelog/dist/tag.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/markdown-summary.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/http-client/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/proxy.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/applyToDefaults.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/assert.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/clone.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/deepEqual.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/error.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeHtml.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeRegex.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/ignore.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/merge.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/reach.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/stringify.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/types.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/utils.js","../webpack:/auto-changelog/node_modules/@hapi/topo/lib/index.js","../webpack:/auto-changelog/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/domain.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/email.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/errors.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/ip.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/tlds.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/uri.js","../webpack:/auto-changelog/node_modules/@sideway/formula/lib/index.js","../webpack:/auto-changelog/node_modules/@sideway/pinpoint/lib/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/deprecation/dist-node/index.js","../webpack:/auto-changelog/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/auto-changelog/node_modules/joi/lib/annotate.js","../webpack:/auto-changelog/node_modules/joi/lib/base.js","../webpack:/auto-changelog/node_modules/joi/lib/cache.js","../webpack:/auto-changelog/node_modules/joi/lib/common.js","../webpack:/auto-changelog/node_modules/joi/lib/compile.js","../webpack:/auto-changelog/node_modules/joi/lib/errors.js","../webpack:/auto-changelog/node_modules/joi/lib/extend.js","../webpack:/auto-changelog/node_modules/joi/lib/index.js","../webpack:/auto-changelog/node_modules/joi/lib/manifest.js","../webpack:/auto-changelog/node_modules/joi/lib/messages.js","../webpack:/auto-changelog/node_modules/joi/lib/modify.js","../webpack:/auto-changelog/node_modules/joi/lib/ref.js","../webpack:/auto-changelog/node_modules/joi/lib/schemas.js","../webpack:/auto-changelog/node_modules/joi/lib/state.js","../webpack:/auto-changelog/node_modules/joi/lib/template.js","../webpack:/auto-changelog/node_modules/joi/lib/trace.js","../webpack:/auto-changelog/node_modules/joi/lib/types/alternatives.js","../webpack:/auto-changelog/node_modules/joi/lib/types/any.js","../webpack:/auto-changelog/node_modules/joi/lib/types/array.js","../Line truncated
+57
View File
@@ -562,6 +562,25 @@ Redistribution and use in source and binary forms, with or without modification,
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
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
node-fetch
MIT
The MIT License (MIT)
@@ -607,6 +626,25 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
semver
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
tr46
MIT
@@ -706,6 +744,25 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
yallist
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
yaml
ISC
Copyright Eemeli Aro <[email protected]>
+1 -1
View File
@@ -1 +1 @@
(()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},284:(e,r,n)=>{e=n.nmd(e);var t=n(596).SourceMapConsumer;var o=n(17);var i;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}var a=n(650);function dynamicRequire(e,r){return e.require(r)}var u=false;var s=false;var l=false;var c="auto";var p={};var f={};var g=/^data:application\/json[^,]+base64,/;var h=[];var d=[];function isInBrowser(){if(c==="browser")return true;if(c==="node")return false;return typeof window!=="undefined"&&typeof XMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function hasGlobalProcessEventEmitter(){return typeof process==="object"&&process!==null&&typeof process.on==="function"}function globalProcessVersion(){if(typeof process==="object"&&process!==null){return process.version}else{return""}}function globalProcessStderr(){if(typeof process==="object"&&process!==null){return process.stderr}}function globalProcessExit(e){if(typeof process==="object"&&process!==null&&typeof process.exit==="function"){return process.exit(e)}}function handlerExec(e){return function(r){for(var n=0;n<e.length;n++){var t=e[n](r);if(t){return t}}return null}}var m=handlerExec(h);h.push((function(e){e=e.trim();if(/^file:/.test(e)){e=e.replace(/file:\/\/\/(\w:)?/,(function(e,r){return r?"":"/"}))}if(e in p){return p[e]}var r="";try{if(!i){var n=new XMLHttpRequest;n.open("GET",e,false);n.send(null);if(n.readyState===4&&n.status===200){r=n.responseText}}else if(i.existsSync(e)){r=i.readFileSync(e,"utf8")}}catch(e){}return p[e]=r}));function supportRelativeURL(e,r){if(!e)return r;var n=o.dirname(e);var t=/^\w+:\/\/[^\/]*/.exec(n);var i=t?t[0]:"";var a=n.slice(i.length);if(i&&/^\/\w\:/.test(a)){i+="/";return i+o.resolve(n.slice(i.length),r).replace(/\\/g,"/")}return i+o.resolve(n.slice(i.length),r)}function retrieveSourceMapURL(e){var r;if(isInBrowser()){try{var n=new XMLHttpRequest;n.open("GET",e,false);n.send(null);r=n.readyState===4?n.responseText:null;var t=n.getResponseHeader("SourceMap")||n.getResponseHeader("X-SourceMap");if(t){return t}}catch(e){}}r=m(e);var o=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/gm;var i,a;while(a=o.exec(r))i=a;if(!i)return null;return i[1]}var v=handlerExec(d);d.push((function(e){var r=retrieveSourceMapURL(e);if(!r)return null;var n;if(g.test(r)){var t=r.slice(r.indexOf(",")+1);n=a(t,"base64").toString();r=e}else{r=supportRelativeURL(e,r);n=m(r)}if(!n){return null}return{url:r,map:n}}));function mapSourcePosition(e){var r=f[e.source];if(!r){var n=v(e.source);if(n){r=f[e.source]={url:n.url,map:new t(n.map)};if(r.map.sourcesContent){r.map.sources.forEach((function(e,n){var t=r.map.sourcesContent[n];if(t){var o=supportRelativeURL(r.url,e);p[o]=t}}))}}else{r=f[e.source]={url:null,map:null}}}if(r&&r.map&&typeof r.map.originalPositionFor==="function"){var o=r.map.originalPositionFor(e);if(o.source!==null){o.source=supportRelativeURL(r.url,o.source);return o}}return e}function mapEvalOrigin(e){var r=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e);if(r){var n=mapSourcePosition({source:r[2],line:+r[3],column:r[4]-1});return"eval at "+r[1]+" ("+n.source+":"+n.line+":"+(n.column+1)+")"}r=/^eval at ([^(]+) \((.+)\)$/.exec(e);if(r){return"eval at "+r[1]+" ("+mapEvalOrigin(r[2])+")"}return e}function CallSiteToString(){var e;var r="";if(this.isNative()){r="native"}else{e=this.getScriptNameOrSourceURL();if(!e&&this.isEval()){r=this.getEvalOrigin();r+=", "}if(e){r+=e}else{r+="<anonymous>"}var n=this.getLineNumber();if(n!=null){r+=":"+n;var t=this.getColumnNumber();if(t){r+=":"+t}}}var o="";var i=this.getFunctionName();var a=true;var u=this.isConstructor();var s=!(this.isToplevel()||u);if(s){var l=this.getTypeName();if(l==="[object Object]"){l="null"}var c=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"<anonymous>")}}else if(u){o+="new "+(i||"<anonymous>")}else if(i){o+=i}elLine truncated
(()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{var t=n(339);var o=Object.prototype.hasOwnProperty;var i=typeof Map!=="undefined";function ArraySet(){this._array=[];this._set=i?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,r){var n=new ArraySet;for(var t=0,o=e.length;t<o;t++){n.add(e[t],r)}return n};ArraySet.prototype.size=function ArraySet_size(){return i?this._set.size:Object.getOwnPropertyNames(this._set).length};ArraySet.prototype.add=function ArraySet_add(e,r){var n=i?e:t.toSetString(e);var a=i?this.has(e):o.call(this._set,n);var u=this._array.length;if(!a||r){this._array.push(e)}if(!a){if(i){this._set.set(e,u)}else{this._set[n]=u}}};ArraySet.prototype.has=function ArraySet_has(e){if(i){return this._set.has(e)}else{var r=t.toSetString(e);return o.call(this._set,r)}};ArraySet.prototype.indexOf=function ArraySet_indexOf(e){if(i){var r=this._set.get(e);if(r>=0){return r}}else{var n=t.toSetString(e);if(o.call(this._set,n)){return this._set[n]}}throw new Error('"'+e+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e<this._array.length){return this._array[e]}throw new Error("No element indexed by "+e)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};r.I=ArraySet},449:(e,r,n)=>{var t=n(190);var o=5;var i=1<<o;var a=i-1;var u=i;function toVLQSigned(e){return e<0?(-e<<1)+1:(e<<1)+0}function fromVLQSigned(e){var r=(e&1)===1;var n=e>>1;return r?-n:n}r.encode=function base64VLQ_encode(e){var r="";var n;var i=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);return r};r.decode=function base64VLQ_decode(e,r,n){var i=e.length;var s=0;var l=0;var c,p;do{if(r>=i){throw new Error("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){throw new Error("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<<l);l+=o}while(c);n.value=fromVLQSigned(s);n.rest=r}},190:(e,r)=>{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e<n.length){return n[e]}throw new TypeError("Must be between 0 and 63: "+e)};r.decode=function(e){var r=65;var n=90;var t=97;var o=122;var i=48;var a=57;var u=43;var s=47;var l=26;var c=52;if(r<=e&&e<=n){return e-r}if(t<=e&&e<=o){return e-t+l}if(i<=e&&e<=a){return e-i+c}if(e==u){return 62}if(e==s){return 63}return-1}},345:(e,r)=>{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;function recursiveSearch(e,n,t,o,i,a){var u=Math.floor((n-e)/2)+e;var s=i(t,o[u],true);if(s===0){return u}else if(s>0){if(n-u>1){return recursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return n<o.length?n:-1}else{return u}}else{if(u-e>1){return recursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return u}else{return e<0?-1:e}}}r.search=function search(e,n,t,o){if(n.length===0){return-1}var i=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}return i}},680:(e,r,n)=>{var t=n(339);function generatedPositionAfter(e,r){var n=e.generatedLine;var o=r.generatedLine;var i=e.generatedColumn;var a=r.generatedColumn;return o>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=function MappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}return this._array};r.H=MappingList},758:(e,r)=>{function swap(e,r,n){var t=e[r];e[r]=e[n];e[n]=t}function randomIntInRange(e,r){return Math.round(e+Math.random()*(r-e))}function doQuickSort(e,r,n,t){if(n<t){var o=randomIntInRange(n,t);var i=n-1;swap(e,o,t);var a=e[t];for(var u=n;u<t;u++){if(r(e[u],Line truncated
+22 -14
View File
@@ -12,9 +12,11 @@
"@actions/core": "^1.7.0",
"@actions/github": "^5.0.1",
"joi": "^17.6.0",
"semver": "^7.3.7",
"yaml": "^2.0.1"
},
"devDependencies": {
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@vercel/ncc": "^0.33.4",
@@ -263,6 +265,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true
},
"node_modules/@types/semver": {
"version": "7.3.9",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz",
"integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==",
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.21.0.tgz",
@@ -1228,7 +1236,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -1500,10 +1507,9 @@
}
},
"node_modules/semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@@ -1735,8 +1741,7 @@
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/yaml": {
"version": "2.0.1",
@@ -1967,6 +1972,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true
},
"@types/semver": {
"version": "7.3.9",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz",
"integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==",
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "5.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.21.0.tgz",
@@ -2665,7 +2676,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
@@ -2831,10 +2841,9 @@
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"requires": {
"lru-cache": "^6.0.0"
}
@@ -3002,8 +3011,7 @@
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"yaml": {
"version": "2.0.1",
+2
View File
@@ -36,9 +36,11 @@
"@actions/core": "^1.7.0",
"@actions/github": "^5.0.1",
"joi": "^17.6.0",
"semver": "^7.3.7",
"yaml": "^2.0.1"
},
"devDependencies": {
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@vercel/ncc": "^0.33.4",
+2 -1
View File
@@ -21,7 +21,8 @@ export async function generate(input: ChangelogInputI): Promise<string> {
const message = commit.commit.message.split("\n")[0];
let [, type, category, title, flag] = COMMIT_REGEX.exec(message) || [];
let { type, category, title, flag } =
COMMIT_REGEX.exec(message)?.groups ?? {};
if (!title) continue;
+12 -1
View File
@@ -1,7 +1,8 @@
import type { GitHub } from "@actions/github/lib/utils";
import type { SemVer } from "semver";
export const COMMIT_REGEX =
/^([^)]*)(?:\(([^)]*?)\)|):(.*?)(?:\[([^\]]+?)\]|)\s*$/;
/^(?<type>[^)]*)(?:\((?<category>[^)]*?)\)|):(?<title>.*?)(?:\[(?<flag>[^\]]+?)\]|)\s*$/;
export const PR_REGEX = /#([1-9]\d*)/g;
export interface TypesI {
@@ -19,6 +20,15 @@ export interface LogI {
commits: string[];
}
export interface TagInputI {
octokit: InstanceType<typeof GitHub>;
owner: string;
repo: string;
sha: string;
semver: SemVer | null;
prerelease: boolean;
}
export interface ChangelogInputI {
octokit: InstanceType<typeof GitHub>;
owner: string;
@@ -31,4 +41,5 @@ export interface ChangelogInputI {
export interface ActionInputsI {
commitTypes: TypesI;
defaultCommitType: string;
semver: boolean;
}
+4 -2
View File
@@ -1,4 +1,4 @@
import { getInput } from "@actions/core";
import { getInput, getBooleanInput } from "@actions/core";
import Joi from "joi";
import YAML from "yaml";
import { ActionInputsI, TypesI } from "./constants";
@@ -10,6 +10,7 @@ export function getToken(): string {
export async function getInputs(): Promise<ActionInputsI> {
const commitTypes = YAML.parse(getInput("commit-types", { required: true }));
const defaultCommitType = getInput("default-commit-type", { required: true });
const semver = getBooleanInput("semver", { required: true });
return Joi.object<ActionInputsI, true>()
.keys({
@@ -17,6 +18,7 @@ export async function getInputs(): Promise<ActionInputsI> {
.pattern(Joi.string(), Joi.string())
.required(),
defaultCommitType: Joi.string().required(),
semver: Joi.boolean().required(),
})
.validateAsync({ commitTypes, defaultCommitType });
.validateAsync({ commitTypes, defaultCommitType, semver });
}
+28 -11
View File
@@ -1,5 +1,7 @@
import { info, setFailed, setOutput } from "@actions/core";
import { context, getOctokit } from "@actions/github";
import SemVer from "semver";
import { getTagSha } from "./tag.js";
import { generate } from "./changelog";
import { getInputs, getToken } from "./context";
@@ -11,22 +13,33 @@ async function run() {
const {
repo: { owner, repo },
sha,
ref,
} = context;
const { data: tags } = await octokit.rest.repos.listTags({
let semver: SemVer.SemVer | null = null;
if (inputs.semver) {
semver = SemVer.parse(ref, { includePrerelease: true });
if (semver == null)
return setFailed(
`Expected a semver compatible ref, got "${ref}" instead.`,
);
}
let prerelease = false;
if (semver != null) prerelease = semver.prerelease.length > 0;
const tagRef = await getTagSha({
octokit,
owner,
repo,
per_page: 2,
sha,
semver,
prerelease,
});
let tagRef: string | undefined;
if (tags.length > 0) {
if (sha === tags[0].commit.sha) {
if (tags.length > 1) tagRef = tags[1].commit.sha;
} else tagRef = tags[0].commit.sha;
}
const changelog = await generate({
octokit,
owner,
@@ -39,6 +52,10 @@ async function run() {
info(changelog);
setOutput("changelog", changelog);
info(`prerelease: ${prerelease}`);
setOutput("prerelease", prerelease);
}
run().catch((error) => setFailed(error.message));
run().catch(setFailed);
+34
View File
@@ -0,0 +1,34 @@
import SemVer from "semver";
import { TagInputI } from "./constants.js";
export async function getTagSha(input: TagInputI): Promise<string | undefined> {
const { octokit, owner, repo, sha, semver, prerelease } = input;
for await (const { data } of octokit.paginate.iterator(
octokit.rest.repos.listTags,
{
per_page: 100,
owner,
repo,
},
)) {
for (const {
name,
commit: { sha: tagSha },
} of data) {
if (sha === tagSha) continue;
if (semver == null) return tagSha;
const tagSemver = SemVer.parse(name, { includePrerelease: true });
if (tagSemver == null || semver.compare(tagSemver) <= 0) continue;
if (tagSemver.prerelease.length > 0 && !prerelease) continue;
return tagSha;
}
}
return undefined;
}
+7 -7
View File
@@ -3,10 +3,10 @@
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
"incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"incremental": true, /* Enable incremental compilation */
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"lib": ["ES2017"], /* Specify library files to be included in the compilation. */
"lib": ["ESNext"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
@@ -14,8 +14,8 @@
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "dist", /* Redirect output structure to the directory. */
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"outDir": "dist", /* Redirect output structure to the directory. */
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
@@ -32,7 +32,7 @@
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
@@ -41,7 +41,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */