mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-01 14:38:47 +00:00
feat: Add default token input value
This commit is contained in:
8 files changed
+71
-55
No files matched your search
@@ -43,6 +43,8 @@ The `flag` is optional (if provided, it must be surrounded in square brackets) a
|
||||
|
||||
Github token.
|
||||
|
||||
_Default:_ `${{ github.token }}`
|
||||
|
||||
#### `exclude` **(Optional)**
|
||||
|
||||
Exclude selected commit types (comma separated).
|
||||
@@ -58,6 +60,5 @@ The generated changelog.
|
||||
```yaml
|
||||
uses: ardalanamini/auto-changelog@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
exclude: 'perf,other,breaking'
|
||||
```
|
||||
+10
@@ -1,20 +1,30 @@
|
||||
name: 'Auto Changelog'
|
||||
|
||||
description: 'Automatic Changelog generator'
|
||||
|
||||
author: 'Ardalan Amini'
|
||||
|
||||
branding:
|
||||
icon: 'clock'
|
||||
color: 'blue'
|
||||
|
||||
inputs:
|
||||
|
||||
token:
|
||||
description: 'Github token'
|
||||
default: ${{ github.token }}
|
||||
required: true
|
||||
|
||||
exclude:
|
||||
description: 'Exclude selected commit types (comma separated)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
outputs:
|
||||
|
||||
changelog:
|
||||
description: 'The generated changelogs'
|
||||
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: 'action/index.js'
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:function(e,p){"use strict";var a=this&&this.__awaiter||function(e,p,a,d){function adopt(e){return e instanceof a?e:new a((function(p){p(e)}))}return new(a||(a=Promise))((function(a,t){function fulfilled(e){try{step(d.next(e))}catch(e){t(e)}}function rejected(e){try{step(d["throw"](e))}catch(e){t(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((d=d.apply(e,p||[])).next())}))};var d=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var p=e[Symbol.asyncIterator],a;return p?p.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(p){a[p]=e[p]&&function(a){return new Promise((function(d,t){a=e[p](a),settle(d,t,a.done,a.value)}))}}function settle(e,p,a,d){Promise.resolve(d).then((function(p){e({value:p,done:a})}),p)}};var t=this&&this.__rest||function(e,p){var a={};for(var d in e)if(Object.prototype.hasOwnProperty.call(e,d)&&p.indexOf(d)<0)a[d]=e[d];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var t=0,d=Object.getOwnPropertySymbols(e);t<d.length;t++){if(p.indexOf(d[t])<0&&Object.prototype.propertyIsEnumerable.call(e,d[t]))a[d[t]]=e[d[t]]}return a};Object.defineProperty(p,"__esModule",{value:true});p.generate=void 0;function generate(e){var p,o;var m,l,n;return a(this,void 0,void 0,(function*(){const{octokit:a,owner:u,repo:c,sha:v,tagRef:h}=e;let{exclude:w}=e;w=w.map((e=>{var p;return(p=s[e])!==null&&p!==void 0?p:e}));const g=`https://github.com/${u}/${c}`;const T={};try{e:for(var _=d(a.paginate.iterator(a.rest.repos.listCommits,{per_page:100,owner:u,repo:c,sha:v})),b;b=yield _.next(),!b.done;){const{data:e}=b.value;for(let p of e){const{sha:e}=p,a=t(p,["sha"]);if(e===h)break e;const d=a.commit.message.split("\n")[0];let[,o,u,c,v]=r.exec(d)||[];if(!c)continue;v=trim(v);if(v==="ignore")continue;o=trim(o);o=(m=s[o])!==null&&m!==void 0?m:s.other;u=u?trim(u):"";c=trim(c).replace(i,((e,p)=>`[${e}](${g}/pull/${p})`));T[o]=(l=T[o])!==null&&l!==void 0?l:{};T[o][u]=(n=T[o][u])!==null&&n!==void 0?n:[];const w=T[o][u].findIndex((e=>e.title===c));if(w===-1)T[o][u].push({title:c,commits:[e]});else T[o][u][w].commits.push(e)}}}catch(e){p={error:e}}finally{try{if(b&&!b.done&&(o=_.return))yield o.call(_)}finally{if(p)throw p.error}}return Object.values(s).filter((e=>!w.includes(e))).sort().reduce(((e,p)=>{const a=T[p];if(a==null)return e;e.push(`### ${p}`,"");const d=Object.keys(a).sort();for(const p of d){const d=a[p];const t=p.length===0;if(!t)e.push(`* **${p}:**`);const r=t?"":" ";for(const{title:p,commits:a}of d){e.push(`${r}* ${p} (${a.map((e=>`[${e.slice(0,8)}](${g}/commit/${e})`)).join(",")})`)}}e.push("");return e}),[]).join("\n")}))}p.generate=generate;function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}const r=/^([^)]*)(?:\(([^)]*?)\)|):(.*?)(?:\[([^\]]+?)\]|)\s*$/;const i=/#([1-9]\d*)/g;const s={breaking:"Breaking Changes",build:"Build System",ci:"Continuous Integration",chore:"Chores",deps:"Dependencies",docs:"Documentation Changes",feat:"New Features",fix:"Bug Fixes",other:"Other Changes",perf:"Performance Improvements",refactor:"Refactors",revert:"Reverts",style:"Code Style Changes",test:"Tests"}},9283:function(e,p,a){"use strict";var d=this&&this.__awaiter||function(e,p,a,d){function adopt(e){return e instanceof a?e:new a((function(p){p(e)}))}return new(a||(a=Promise))((function(a,t){function fulfilled(e){try{step(d.next(e))}catch(e){t(e)}}function rejected(e){try{step(d["throw"](e))}catch(e){t(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((d=d.apply(e,p||[])).next())}))};Object.defineProperty(p,"__esModule",{value:true});const t=a(2186);const r=a(5438);const i=a(7412);function run(){return d(this,void 0,void 0,(function*(){const e=(0,t.getInput)("token",{required:true});const p=(0,t.getInput)("exclude",{required:false}).split(",");const a=(0,r.getOctokit)(e);const{repo:{owner:d,repo:s},sha:o}=r.context;const{data:m}=yield a.rest.repos.listTags({owner:d,repo:s,per_page:2});let l;if(m.length>0){if(o===m[0].commit.sha){if(m.length>1)l=m[1].commit.sha}else l=m[0].commit.sha}const n=yield(0,i.generate)({octokit:a,exclude:p,owner:d,repo:s,sha:o,tagRef:l});(0,t.info)(n);(0,t.setOutput)("changelog",n)}))}run().catch((e=>(0,t.setFailed)(e.message)))},7351:function(e,p,a){"use strict";var d=this&&this.__createBinding||(Object.create?function(e,p,a,d){if(d===undefined)d=a;Object.defineProperty(e,d,{enumerable:true,get:function(){return p[a]}})}:function(e,p,a,d){if(d===undefined)d=a;e[d]=p[a]});var t=this&&this.__setModuleDefault||(Object.create?function(e,p){Object.defineProperty(e,"default",{enumerable:true,value:p})}:function(e,p){e["default"]=p});var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var p={};if(e!=nullLine truncated
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:function(e,p,a){"use strict";var d=this&&this.__awaiter||function(e,p,a,d){function adopt(e){return e instanceof a?e:new a((function(p){p(e)}))}return new(a||(a=Promise))((function(a,t){function fulfilled(e){try{step(d.next(e))}catch(e){t(e)}}function rejected(e){try{step(d["throw"](e))}catch(e){t(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((d=d.apply(e,p||[])).next())}))};var t=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var p=e[Symbol.asyncIterator],a;return p?p.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(p){a[p]=e[p]&&function(a){return new Promise((function(d,t){a=e[p](a),settle(d,t,a.done,a.value)}))}}function settle(e,p,a,d){Promise.resolve(d).then((function(p){e({value:p,done:a})}),p)}};var r=this&&this.__rest||function(e,p){var a={};for(var d in e)if(Object.prototype.hasOwnProperty.call(e,d)&&p.indexOf(d)<0)a[d]=e[d];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var t=0,d=Object.getOwnPropertySymbols(e);t<d.length;t++){if(p.indexOf(d[t])<0&&Object.prototype.propertyIsEnumerable.call(e,d[t]))a[d[t]]=e[d[t]]}return a};Object.defineProperty(p,"__esModule",{value:true});p.generate=void 0;const i=a(1912);function generate(e){var p,a;var s,o,m;return d(this,void 0,void 0,(function*(){const{octokit:d,exclude:l,owner:n,repo:u,sha:c,tagRef:v}=e;const h=`https://github.com/${n}/${u}`;const w={};try{e:for(var g=t(d.paginate.iterator(d.rest.repos.listCommits,{per_page:100,owner:n,repo:u,sha:c})),T;T=yield g.next(),!T.done;){const{data:e}=T.value;for(let p of e){const{sha:e}=p,a=r(p,["sha"]);if(e===v)break e;const d=a.commit.message.split("\n")[0];let[,t,l,n,u]=i.COMMIT_REGEX.exec(d)||[];if(!n)continue;u=trim(u);if(u==="ignore")continue;t=trim(t);t=(s=i.TYPES[t])!==null&&s!==void 0?s:i.TYPES.other;l=l?trim(l):"";n=trim(n).replace(i.PR_REGEX,((e,p)=>`[${e}](${h}/pull/${p})`));w[t]=(o=w[t])!==null&&o!==void 0?o:{};w[t][l]=(m=w[t][l])!==null&&m!==void 0?m:[];const c=w[t][l].findIndex((e=>e.title===n));if(c===-1)w[t][l].push({title:n,commits:[e]});else w[t][l][c].commits.push(e)}}}catch(e){p={error:e}}finally{try{if(T&&!T.done&&(a=g.return))yield a.call(g)}finally{if(p)throw p.error}}return Object.values(i.TYPES).filter((e=>!l.includes(e))).sort().reduce(((e,p)=>{const a=w[p];if(a==null)return e;e.push(`### ${p}`,"");const d=Object.keys(a).sort();for(const p of d){const d=a[p];const t=p.length===0;if(!t)e.push(`* **${p}:**`);const r=t?"":" ";for(const{title:p,commits:a}of d){e.push(`${r}* ${p} (${a.map((e=>`[${e.slice(0,8)}](${h}/commit/${e})`)).join(",")})`)}}e.push("");return e}),[]).join("\n")}))}p.generate=generate;function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}},1912:(e,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:true});p.TYPES=p.PR_REGEX=p.COMMIT_REGEX=void 0;p.COMMIT_REGEX=/^([^)]*)(?:\(([^)]*?)\)|):(.*?)(?:\[([^\]]+?)\]|)\s*$/;p.PR_REGEX=/#([1-9]\d*)/g;p.TYPES={breaking:"Breaking Changes",build:"Build System",ci:"Continuous Integration",chore:"Chores",deps:"Dependencies",docs:"Documentation Changes",feat:"New Features",fix:"Bug Fixes",other:"Other Changes",perf:"Performance Improvements",refactor:"Refactors",revert:"Reverts",style:"Code Style Changes",test:"Tests"}},9283:function(e,p,a){"use strict";var d=this&&this.__awaiter||function(e,p,a,d){function adopt(e){return e instanceof a?e:new a((function(p){p(e)}))}return new(a||(a=Promise))((function(a,t){function fulfilled(e){try{step(d.next(e))}catch(e){t(e)}}function rejected(e){try{step(d["throw"](e))}catch(e){t(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((d=d.apply(e,p||[])).next())}))};Object.defineProperty(p,"__esModule",{value:true});const t=a(2186);const r=a(5438);const i=a(7412);const s=a(1912);function run(){return d(this,void 0,void 0,(function*(){const e=(0,t.getInput)("token",{required:true});const p=(0,t.getInput)("exclude",{required:false}).split(",").map((e=>{var p;return(p=s.TYPES[e])!==null&&p!==void 0?p:e}));const a=(0,r.getOctokit)(e);const{repo:{owner:d,repo:o},sha:m}=r.context;const{data:l}=yield a.rest.repos.listTags({owner:d,repo:o,per_page:2});let n;if(l.length>0){if(m===l[0].commit.sha){if(l.length>1)n=l[1].commit.sha}else n=l[0].commit.sha}const u=yield(0,i.generate)({octokit:a,exclude:p,owner:d,repo:o,sha:m,tagRef:n});(0,t.info)(u);(0,t.setOutput)("changelog",u)}))}run().catch((e=>(0,t.setFailed)(e.message)))},7351:function(e,p,a){"use strict";var d=this&&this.__createBinding||(Object.create?function(e,p,a,d){if(d===undefined)d=a;Object.defineProperty(e,d,{enumerable:true,get:function(){return p[a]}})}:function(e,p,a,d){if(d===undefined)d=a;e[d]=p[a]});var t=this&&this.__setModuleDefault||(Object.creatLine 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 p,a;if(isObject(e)===false)return false;p=e.constructor;if(p===undefined)return true;a=p.prototype;if(isObject(a)===false)return false;if(a.hasOwnProperty("isPrototypeOf")===false){return false}return true}p.isPlainObject=isPlainObject},467:(e,p,a)=>{"use strict";Object.defineProperty(p,"__esModule",{value:true});function _interopDefault(e){return e&&typeof e==="object"&&"default"in e?e["default"]:e}var d=_interopDefault(a(2781));var t=_interopDefault(a(3685));var r=_interopDefault(a(7310));var i=_interopDefault(a(8665));var s=_interopDefault(a(5687));var o=_interopDefault(a(9796));const m=d.Readable;const l=Symbol("buffer");const n=Symbol("type");class Blob{constructor(){this[n]="";const e=arguments[0];const p=arguments[1];const a=[];let d=0;if(e){const p=e;const t=Number(p.length);for(let e=0;e<t;e++){const t=p[e];let r;if(t instanceof Buffer){r=t}else if(ArrayBuffer.isView(t)){r=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof ArrayBuffer){r=Buffer.from(t)}else if(t instanceof Blob){r=t[l]}else{r=Buffer.from(typeof t==="string"?t:String(t))}d+=r.length;a.push(r)}}this[l]=Buffer.concat(a);let t=p&&p.type!==undefined&&String(p.type).toLowerCase();if(t&&!/[^\u0020-\u007E]/.test(t)){this[n]=t}}get size(){return this[l].length}get type(){return this[n]}text(){return Promise.resolve(this[l].toString())}arrayBuffer(){const e=this[l];const p=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(p)}stream(){const e=new m;e._read=function(){};e.push(this[l]);e.push(null);return e}toString(){return"[object Blob]"}slice(){const e=this.size;const p=arguments[0];const a=arguments[1];let d,t;if(p===undefined){d=0}else if(p<0){d=Math.max(e+p,0)}else{d=Math.min(p,e)}if(a===undefined){t=e}else if(a<0){t=Math.max(e+a,0)}else{t=Math.min(a,e)}const r=Math.max(t-d,0);const i=this[l];const s=i.slice(d,d+r);const o=new Blob([],{type:arguments[2]});o[l]=s;return o}}Object.defineProperties(Blob.prototype,{size:{enumerable:true},type:{enumerable:true},slice:{enumerable:true}});Object.defineProperty(Blob.prototype,Symbol.toStringTag,{value:"Blob",writable:false,enumerable:false,configurable:true});function FetchError(e,p,a){Error.call(this,e);this.message=e;this.type=p;if(a){this.code=this.errno=a.code}Error.captureStackTrace(this,this.constructor)}FetchError.prototype=Object.create(Error.prototype);FetchError.prototype.constructor=FetchError;FetchError.prototype.name="FetchError";let u;try{u=a(2877).convert}catch(e){}const c=Symbol("Body internals");const v=d.PassThrough;function Body(e){var p=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},t=a.size;let r=t===undefined?0:t;var i=a.timeout;let s=i===undefined?0:i;if(e==null){e=null}else if(isURLSearchParams(e)){e=Buffer.from(e.toString())}else if(isBlob(e));else if(Buffer.isBuffer(e));else if(Object.prototype.toString.call(e)==="[object ArrayBuffer]"){e=Buffer.from(e)}else if(ArrayBuffer.isView(e)){e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(e instanceof d);else{e=Buffer.from(String(e))}this[c]={body:e,disturbed:false,error:null};this.size=r;this.timeout=s;if(e instanceof d){e.on("error",(function(e){const a=e.name==="AbortError"?e:new FetchError(`Invalid response body while trying to fetch ${p.url}: ${e.message}`,"system",e);p[c].error=a}))}}Body.prototype={get body(){return this[c].body},get bodyUsed(){return this[c].disturbed},arrayBuffer(){return consumeBody.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return consumeBody.call(this).then((function(p){return Object.assign(new Blob([],{type:e.toLowerCase()}),{[l]:p})}))},json(){var e=this;return consumeBody.call(this).then((function(p){try{return JSON.parse(p.toString())}catch(p){return Body.Promise.reject(new FetchError(`invalid json response body at ${e.url} reason: ${p.message}`,"invalid-json"))}}))},text(){return consumeBody.call(this).then((function(e){return e.toString()}))},buffer(){return consumeBody.call(this)},textConverted(){var e=this;return consumeBody.call(this).then((function(p){return convertBody(p,e.headers)}))}};Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true}});Body.mixIn=function(e){for(const p of Object.getOwnPropertyNames(Body.prototype)){if(!(p in e)){const a=Object.getOwnPropertyDescriptor(Body.prototype,p);Object.defineProperty(e,p,a)}}};function consumeBody(){var e=this;if(this[c].disturbed){return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`))}this[c].disturbed=true;if(this[c].error){return Body.Promise.reject(this[c].error)}let p=this.body;if(p===null){return Body.Promise.resolve(Buffer.alloc(0))}if(isBlob(p)){p=p.stream()}if(Buffer.iLine truncated
|
||||
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var p,a;if(isObject(e)===false)return false;p=e.constructor;if(p===undefined)return true;a=p.prototype;if(isObject(a)===false)return false;if(a.hasOwnProperty("isPrototypeOf")===false){return false}return true}p.isPlainObject=isPlainObject},467:(e,p,a)=>{"use strict";Object.defineProperty(p,"__esModule",{value:true});function _interopDefault(e){return e&&typeof e==="object"&&"default"in e?e["default"]:e}var d=_interopDefault(a(2781));var t=_interopDefault(a(3685));var r=_interopDefault(a(7310));var i=_interopDefault(a(8665));var s=_interopDefault(a(5687));var o=_interopDefault(a(9796));const m=d.Readable;const l=Symbol("buffer");const n=Symbol("type");class Blob{constructor(){this[n]="";const e=arguments[0];const p=arguments[1];const a=[];let d=0;if(e){const p=e;const t=Number(p.length);for(let e=0;e<t;e++){const t=p[e];let r;if(t instanceof Buffer){r=t}else if(ArrayBuffer.isView(t)){r=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof ArrayBuffer){r=Buffer.from(t)}else if(t instanceof Blob){r=t[l]}else{r=Buffer.from(typeof t==="string"?t:String(t))}d+=r.length;a.push(r)}}this[l]=Buffer.concat(a);let t=p&&p.type!==undefined&&String(p.type).toLowerCase();if(t&&!/[^\u0020-\u007E]/.test(t)){this[n]=t}}get size(){return this[l].length}get type(){return this[n]}text(){return Promise.resolve(this[l].toString())}arrayBuffer(){const e=this[l];const p=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(p)}stream(){const e=new m;e._read=function(){};e.push(this[l]);e.push(null);return e}toString(){return"[object Blob]"}slice(){const e=this.size;const p=arguments[0];const a=arguments[1];let d,t;if(p===undefined){d=0}else if(p<0){d=Math.max(e+p,0)}else{d=Math.min(p,e)}if(a===undefined){t=e}else if(a<0){t=Math.max(e+a,0)}else{t=Math.min(a,e)}const r=Math.max(t-d,0);const i=this[l];const s=i.slice(d,d+r);const o=new Blob([],{type:arguments[2]});o[l]=s;return o}}Object.defineProperties(Blob.prototype,{size:{enumerable:true},type:{enumerable:true},slice:{enumerable:true}});Object.defineProperty(Blob.prototype,Symbol.toStringTag,{value:"Blob",writable:false,enumerable:false,configurable:true});function FetchError(e,p,a){Error.call(this,e);this.message=e;this.type=p;if(a){this.code=this.errno=a.code}Error.captureStackTrace(this,this.constructor)}FetchError.prototype=Object.create(Error.prototype);FetchError.prototype.constructor=FetchError;FetchError.prototype.name="FetchError";let u;try{u=a(2877).convert}catch(e){}const c=Symbol("Body internals");const v=d.PassThrough;function Body(e){var p=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},t=a.size;let r=t===undefined?0:t;var i=a.timeout;let s=i===undefined?0:i;if(e==null){e=null}else if(isURLSearchParams(e)){e=Buffer.from(e.toString())}else if(isBlob(e));else if(Buffer.isBuffer(e));else if(Object.prototype.toString.call(e)==="[object ArrayBuffer]"){e=Buffer.from(e)}else if(ArrayBuffer.isView(e)){e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(e instanceof d);else{e=Buffer.from(String(e))}this[c]={body:e,disturbed:false,error:null};this.size=r;this.timeout=s;if(e instanceof d){e.on("error",(function(e){const a=e.name==="AbortError"?e:new FetchError(`Invalid response body while trying to fetch ${p.url}: ${e.message}`,"system",e);p[c].error=a}))}}Body.prototype={get body(){return this[c].body},get bodyUsed(){return this[c].disturbed},arrayBuffer(){return consumeBody.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return consumeBody.call(this).then((function(p){return Object.assign(new Blob([],{type:e.toLowerCase()}),{[l]:p})}))},json(){var e=this;return consumeBody.call(this).then((function(p){try{return JSON.parse(p.toString())}catch(p){return Body.Promise.reject(new FetchError(`invalid json response body at ${e.url} reason: ${p.message}`,"invalid-json"))}}))},text(){return consumeBody.call(this).then((function(e){return e.toString()}))},buffer(){return consumeBody.call(this)},textConverted(){var e=this;return consumeBody.call(this).then((function(p){return convertBody(p,e.headers)}))}};Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true}});Body.mixIn=function(e){for(const p of Object.getOwnPropertyNames(Body.prototype)){if(!(p in e)){const a=Object.getOwnPropertyDescriptor(Body.prototype,p);Object.defineProperty(e,p,a)}}};function consumeBody(){var e=this;if(this[c].disturbed){return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`))}this[c].disturbed=true;if(this[c].error){return Body.Promise.reject(this[c].error)}let p=this.body;if(p===null){return Body.Promise.resolve(Buffer.alloc(0))}if(isBlob(p)){p=p.stream()}if(Buffer.iLine truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.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/@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/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/node-fetch/lib/index.js","../webpack:/auto-changelog/node_modules/once/once.js","../webpack:/auto-changelog/node_modules/tr46/index.js","../webpack:/auto-changelog/node_modules/tunnel/index.js","../webpack:/auto-changelog/node_modules/tunnel/lib/tunnel.js","../webpack:/auto-changelog/node_modules/universal-user-agent/dist-node/index.js","../webpack:/auto-changelog/node_modules/webidl-conversions/lib/index.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/URL-impl.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/URL.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/public-api.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/url-state-machine.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/utils.js","../webpack:/auto-changelog/node_modules/wrappy/wrappy.js","../webpack:/auto-changelog/node_modules/@vercel/ncc/dist/ncc/@@notfound.js","../webpack:/auto-changelog/external node-commonjs \"assert\"","../webpack:/auto-changelog/external node-commonjs \"events\"","../webpack:/auto-changelog/external node-commonjs \"fs\"","../webpack:/auto-changelog/external node-commonjs \"http\"","../webpack:/auto-changelog/external node-commonjs \"https\"","../webpack:/auto-changelog/external node-commonjs \"net\"","../webpack:/auto-changelog/external node-commonjs \"os\"","../webpack:/auto-changelog/external node-commonjs \"path\"","../webpack:/auto-changelog/external node-commonjs \"punycode\"","../webpack:/auto-changelog/external node-commonjs \"stream\"","../webpack:/auto-changelog/external node-commonjs \"tls\"","../webpack:/auto-changelog/external node-commonjs \"url\"","../webpack:/auto-changelog/external node-commonjs \"util\"","../webpack:/auto-changelog/external node-commonjs \"zlib\"","../webpack:/auto-changelog/webpack/bootstrap","../webpack:/auto-changelog/webpack/runtime/compat","../webpack:/auto-changelog/webpack/startup"],"names":["__awaiter","this","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__asyncValues","o","Symbol","asyncIterator","TypeError","m","i","call","__values","iterator","verb","n","v","settle","d","__rest","s","t","p","Object","prototype","hasOwnProperty","indexOf","getOwnPropertySymbols","length","propertyIsEnumerable","defineProperty","exports","generate","input","e_1","_a","_b","_c","_d","octokit","owner","repo","sha","tagRef","exclude","map","type","TYPES","repoUrl","commits","paginator","_e","paginate","rest","repos","listCommits","per_page","_f","data","_g","commit","message","split","category","title","flag","COMMIT_REGEX","exec","trim","other","replace","PR_REGEX","match","pull","existingIndex","findIndex","push","e_1_1","error","return","values","filter","includes","sort","reduce","changelog","typeGroup","categories","keys","categoryGrLine truncated
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/constants.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/@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/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/node-fetch/lib/index.js","../webpack:/auto-changelog/node_modules/once/once.js","../webpack:/auto-changelog/node_modules/tr46/index.js","../webpack:/auto-changelog/node_modules/tunnel/index.js","../webpack:/auto-changelog/node_modules/tunnel/lib/tunnel.js","../webpack:/auto-changelog/node_modules/universal-user-agent/dist-node/index.js","../webpack:/auto-changelog/node_modules/webidl-conversions/lib/index.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/URL-impl.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/URL.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/public-api.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/url-state-machine.js","../webpack:/auto-changelog/node_modules/whatwg-url/lib/utils.js","../webpack:/auto-changelog/node_modules/wrappy/wrappy.js","../webpack:/auto-changelog/node_modules/@vercel/ncc/dist/ncc/@@notfound.js","../webpack:/auto-changelog/external node-commonjs \"assert\"","../webpack:/auto-changelog/external node-commonjs \"events\"","../webpack:/auto-changelog/external node-commonjs \"fs\"","../webpack:/auto-changelog/external node-commonjs \"http\"","../webpack:/auto-changelog/external node-commonjs \"https\"","../webpack:/auto-changelog/external node-commonjs \"net\"","../webpack:/auto-changelog/external node-commonjs \"os\"","../webpack:/auto-changelog/external node-commonjs \"path\"","../webpack:/auto-changelog/external node-commonjs \"punycode\"","../webpack:/auto-changelog/external node-commonjs \"stream\"","../webpack:/auto-changelog/external node-commonjs \"tls\"","../webpack:/auto-changelog/external node-commonjs \"url\"","../webpack:/auto-changelog/external node-commonjs \"util\"","../webpack:/auto-changelog/external node-commonjs \"zlib\"","../webpack:/auto-changelog/webpack/bootstrap","../webpack:/auto-changelog/webpack/runtime/compat","../webpack:/auto-changelog/webpack/startup"],"names":["__awaiter","this","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__asyncValues","o","Symbol","asyncIterator","TypeError","m","i","call","__values","iterator","verb","n","v","settle","d","__rest","s","t","p","Object","prototype","hasOwnProperty","indexOf","getOwnPropertySymbols","length","propertyIsEnumerable","defineProperty","exports","generate","constants_1","__webpack_require__","input","e_1","_a","_b","_c","_d","octokit","exclude","owner","repo","sha","tagRef","repoUrl","commits","paginator","_e","paginate","rest","repos","listCommits","per_page","_f","data","_g","commit","message","split","type","category","title","flag","COMMIT_REGEX","exec","trim","TYPES","other","replace","PR_REGEX","match","pull","existingIndex","findIndex","push","e_1_1","error","return","values","filter","inclLine truncated
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
"build": "tsc",
|
||||
"build:watch": "npm run build -- --watch",
|
||||
"package": "ncc build --out action --minify --source-map --license licenses.txt",
|
||||
"all": "npm run lint:format && npm run lint && npm run build && npm run package",
|
||||
"all": "npm run lint:format && npm run lint:fix && npm run build && npm run package",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
+3
-49
@@ -1,12 +1,7 @@
|
||||
import type { GitHub } from "@actions/github/lib/utils";
|
||||
import { COMMIT_REGEX, InputI, LogsI, PR_REGEX, TYPES } from "./constants";
|
||||
|
||||
export async function generate(input: InputI): Promise<string> {
|
||||
const { octokit, owner, repo, sha, tagRef } = input;
|
||||
let { exclude } = input;
|
||||
|
||||
exclude = exclude.map(
|
||||
(type) => (TYPES as { [type: string]: string | undefined })[type] ?? type,
|
||||
);
|
||||
const { octokit, exclude, owner, repo, sha, tagRef } = input;
|
||||
|
||||
const repoUrl = `https://github.com/${owner}/${repo}`;
|
||||
const commits: LogsI = {};
|
||||
@@ -33,8 +28,7 @@ export async function generate(input: InputI): Promise<string> {
|
||||
if (flag === "ignore") continue;
|
||||
|
||||
type = trim(type);
|
||||
type =
|
||||
(TYPES as { [type: string]: string | undefined })[type] ?? TYPES.other;
|
||||
type = TYPES[type] ?? TYPES.other;
|
||||
|
||||
category = category ? trim(category) : "";
|
||||
|
||||
@@ -97,43 +91,3 @@ function trim(value: string): string {
|
||||
|
||||
return value.trim().replace(/ {2,}/g, " ");
|
||||
}
|
||||
|
||||
const COMMIT_REGEX = /^([^)]*)(?:\(([^)]*?)\)|):(.*?)(?:\[([^\]]+?)\]|)\s*$/;
|
||||
const PR_REGEX = /#([1-9]\d*)/g;
|
||||
|
||||
const TYPES = {
|
||||
breaking: "Breaking Changes",
|
||||
build: "Build System",
|
||||
ci: "Continuous Integration",
|
||||
chore: "Chores",
|
||||
deps: "Dependencies",
|
||||
docs: "Documentation Changes",
|
||||
feat: "New Features",
|
||||
fix: "Bug Fixes",
|
||||
other: "Other Changes",
|
||||
perf: "Performance Improvements",
|
||||
refactor: "Refactors",
|
||||
revert: "Reverts",
|
||||
style: "Code Style Changes",
|
||||
test: "Tests",
|
||||
};
|
||||
|
||||
interface LogsI {
|
||||
[type: string]: {
|
||||
[category: string]: LogI[];
|
||||
};
|
||||
}
|
||||
|
||||
interface LogI {
|
||||
title: string;
|
||||
commits: string[];
|
||||
}
|
||||
|
||||
export interface InputI {
|
||||
octokit: InstanceType<typeof GitHub>;
|
||||
exclude: string[];
|
||||
owner: string;
|
||||
repo: string;
|
||||
sha: string;
|
||||
tagRef?: string;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import type { GitHub } from "@actions/github/lib/utils";
|
||||
|
||||
export const COMMIT_REGEX =
|
||||
/^([^)]*)(?:\(([^)]*?)\)|):(.*?)(?:\[([^\]]+?)\]|)\s*$/;
|
||||
export const PR_REGEX = /#([1-9]\d*)/g;
|
||||
|
||||
export const TYPES: TypesI = {
|
||||
breaking: "Breaking Changes",
|
||||
build: "Build System",
|
||||
ci: "Continuous Integration",
|
||||
chore: "Chores",
|
||||
deps: "Dependencies",
|
||||
docs: "Documentation Changes",
|
||||
feat: "New Features",
|
||||
fix: "Bug Fixes",
|
||||
other: "Other Changes",
|
||||
perf: "Performance Improvements",
|
||||
refactor: "Refactors",
|
||||
revert: "Reverts",
|
||||
style: "Code Style Changes",
|
||||
test: "Tests",
|
||||
};
|
||||
|
||||
export interface TypesI {
|
||||
[type: string]: string;
|
||||
}
|
||||
|
||||
export interface LogsI {
|
||||
[type: string]: {
|
||||
[category: string]: LogI[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface LogI {
|
||||
title: string;
|
||||
commits: string[];
|
||||
}
|
||||
|
||||
export interface InputI {
|
||||
octokit: InstanceType<typeof GitHub>;
|
||||
exclude: string[];
|
||||
owner: string;
|
||||
repo: string;
|
||||
sha: string;
|
||||
tagRef?: string;
|
||||
}
|
||||
+6
-1
@@ -1,11 +1,16 @@
|
||||
import { getInput, info, setFailed, setOutput } from "@actions/core";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import { generate } from "./changelog";
|
||||
import { TYPES } from "./constants";
|
||||
|
||||
async function run() {
|
||||
const token = getInput("token", { required: true });
|
||||
const exclude = getInput("exclude", { required: false }).split(",");
|
||||
const exclude = getInput("exclude", { required: false })
|
||||
.split(",")
|
||||
.map((type) => TYPES[type] ?? type);
|
||||
|
||||
const octokit = getOctokit(token);
|
||||
|
||||
const {
|
||||
repo: { owner, repo },
|
||||
sha,
|
||||
|
||||
Reference in new issue
Block a user