mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-02 06:28:53 +00:00
revert: Use generate-changelog package
This commit is contained in:
10 files changed
+126
-145
No files matched your search
@@ -30,12 +30,3 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
exclude: 'chore,ci,build'
|
||||
|
||||
test-with-allow-unknown: # make sure the action works on a clean machine without building
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
allow-unknown: 'true'
|
||||
@@ -12,10 +12,6 @@ Automatic Changelog generator
|
||||
|
||||
Exclude selected commit types (comma separated).
|
||||
|
||||
### `allow-unknown`
|
||||
|
||||
Allow unknown commit types.
|
||||
|
||||
## Outputs
|
||||
|
||||
### `changelog`
|
||||
@@ -29,5 +25,4 @@ uses: ardalanamini/[email protected]
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
exclude: 'perf,other,breaking'
|
||||
allow-unknown: 'true'
|
||||
```
|
||||
@@ -12,10 +12,6 @@ inputs:
|
||||
description: 'Exclude selected commit types (comma separated)'
|
||||
required: false
|
||||
default: ''
|
||||
allow-unknown:
|
||||
description: 'Allow unknown commit types'
|
||||
required: false
|
||||
default: 'false'
|
||||
outputs:
|
||||
changelog:
|
||||
description: 'The generated changelogs'
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
require('./sourcemap-register.js');module.exports=(()=>{var __webpack_modules__={9283:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r(function(t){t(e)})}return new(r||(r=Promise))(function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=r(2186);const i=r(5438);const a=o(r(510));function run(){return n(this,void 0,void 0,function*(){try{const e=s.getInput("token",{required:true});const t=s.getInput("exclude",{required:false}).split(",");const r=s.getInput("allow-unknown",{required:false})==="true";const n=i.getOctokit(e);const{repo:{owner:o,repo:c},sha:u}=i.context;const{data:l}=yield n.repos.listTags({owner:o,repo:c,per_page:2});let p;if(l.length>0){if(u===l[0].commit.sha){if(l.length>1)p=l[1].name}else p=l[0].name}let f=yield a.default.generate({repoUrl:`https://github.com/${o}/${c}`,tag:p,exclude:t,allowUnknown:r});f=f.replace(/^#+ +(\d)/,"#### v$1");s.info(f);s.setOutput("changelog",f)}catch(e){s.setFailed(e.message)}})}run()},7351:function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(Object.hasOwnProperty.call(e,r))t[r]=e[r];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const o=n(r(2087));const s=r(5278);function issueCommand(e,t,r){const n=new Command(e,t,r);process.stdout.write(n.toString()+o.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const i="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=i+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}e+=`${i}${escapeData(this.message)}`;return e}}function escapeData(e){return s.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return s.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r(function(t){t(e)})}return new(r||(r=Promise))(function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(Object.hasOwnProperty.call(e,r))t[r]=e[r];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const s=r(7351);const i=r(717);const a=r(5278);const c=o(r(2087));const u=o(r(5622));var l;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(l=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=a.toCommandValue(t);process.env[e]=r;const n=process.env["GITHUB_ENV"]||"";if(n){const t="_GitHubActionsFileCommandDelimeter_";const n=`${e}<<${t}${c.EOL}${r}${c.EOL}${t}`;i.issueCommand("ENV",n)}else{s.issueCommand("set-env",{name:e},r)}}t.exportVariable=exportVariable;function setSecret(e){s.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){i.issueCommand("PATH",e)}else{s.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}return r.trim()}t.getInput=getInput;function setOutput(e,t){s.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){s.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=l.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){s.issueCommand("debug",{},e)}t.debug=debug;function error(e){s.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){s.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+c.EOL)}t.info=info;function startGroup(e){s.issue("group",e)}t.startGroup=startGroup;function endGroup(){s.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return n(this,void 0,void 0,function*(){startGroup(e)Line truncated
|
||||
require('./sourcemap-register.js');module.exports=(()=>{var __webpack_modules__={412:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,s){function adopt(e){return e instanceof r?e:new r(function(t){t(e)})}return new(r||(r=Promise))(function(r,o){function fulfilled(e){try{step(s.next(e))}catch(e){o(e)}}function rejected(e){try{step(s["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())})};var s=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==="function"?__values(e):e[Symbol.iterator](),r={},verb("next"),verb("throw"),verb("return"),r[Symbol.asyncIterator]=function(){return this},r);function verb(t){r[t]=e[t]&&function(r){return new Promise(function(s,o){r=e[t](r),settle(s,o,r.done,r.value)})}}function settle(e,t,r,s){Promise.resolve(s).then(function(t){e({value:t,done:r})},t)}};var o=this&&this.__rest||function(e,t){var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0)r[s]=e[s];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++){if(t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o]))r[s[o]]=e[s[o]]}return r};Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;function generate(e,t,a,u,l){var p,d;var f,m,g;return r(this,void 0,void 0,function*(){t=t.map(e=>{var t;return(t=c[e])!==null&&t!==void 0?t:e});const r=`https://github.com/${a}/${u}`;const h={};try{e:for(var T=s(e.paginate.iterator(e.repos.listCommits,{per_page:100,owner:a,repo:u})),w;w=yield T.next(),!w.done;){const{data:e}=w.value;for(let t of e){const{sha:e}=t,s=o(t,["sha"]);if(e===l)break e;const a=s.commit.message;let[,u,p,d,T]=n.exec(a)||[];if(!d)continue;u=trim(u);u=(f=c[u])!==null&&f!==void 0?f:c.other;p=p?trim(p):"";T=trim(T);if(T!=="breaking")T=undefined;d=trim(d).replace(i,(e,t)=>`[${e}](${r}/pull/${t})`);if(T)d=d.replace(new RegExp(` ?\\[${T}\\]$`),"");d=`${d} ([${e.slice(0,8)}](${r}/commit/${e}))`;if(T)d+=` **[${T}]**`;h[u]=(m=h[u])!==null&&m!==void 0?m:{};h[u][p]=(g=h[u][p])!==null&&g!==void 0?g:[];h[u][p].push(d)}}}catch(e){p={error:e}}finally{try{if(w&&!w.done&&(d=T.return))yield d.call(T)}finally{if(p)throw p.error}}return Object.values(c).filter(e=>!t.includes(e)).sort().reduce((e,t)=>{const r=h[t];if(r==null)return e;e.push(`### ${t}`,"");const s=Object.keys(r).sort();for(const t of s){const s=r[t];const o=t.length===0;if(!o)e.push(`* **${t}:**`);const n=o?"":" ";for(const t of s){e.push(n+"* "+t)}}e.push("");return e},[]).join("\n")})}t.generate=generate;function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}const n=/^([^)]*)(?:\(([^)]*?)\)|):(.*?(?:\[([^\]]+?)\]|))\s*$/;const i=/#([1-9]\d*)/g;const c={breaking:"Breaking Changes",build:"Build System / Dependencies",ci:"Continuous Integration",chore:"Chores",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"}},283:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){function adopt(e){return e instanceof r?e:new r(function(t){t(e)})}return new(r||(r=Promise))(function(r,o){function fulfilled(e){try{step(s.next(e))}catch(e){o(e)}}function rejected(e){try{step(s["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});const o=r(186);const n=r(438);const i=r(412);function run(){return s(this,void 0,void 0,function*(){try{const e=o.getInput("token",{required:true});const t=o.getInput("exclude",{required:false}).split(",");const r=n.getOctokit(e);const{repo:{owner:s,repo:c},sha:a}=n.context;const{data:u}=yield r.repos.listTags({owner:s,repo:c,per_page:2});let l;if(u.length>0){if(a===u[0].commit.sha){if(u.length>1)l=u[1].commit.sha}else l=u[0].commit.sha}const p=yield i.generate(r,t,s,c,l);o.info(p);o.setOutput("changelog",p)}catch(e){o.setFailed(e.message)}})}run()},351:function(e,t,r){"use strict";var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(Object.hasOwnProperty.call(e,r))t[r]=e[r];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const o=s(r(87));const n=r(278);function issueCommand(e,t,r){const s=new Command(e,t,r);process.stdout.write(s.toString()+o.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const i="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=i+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){ifLine truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../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/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/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/bluebird/js/release/any.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/async.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/bind.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/bluebird.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/call_get.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/cancel.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/catch_filter.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/context.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/debuggability.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/direct_resolve.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/each.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/errors.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/es5.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/filter.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/finally.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/generators.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/join.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/map.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/method.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/nodeback.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/nodeify.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/promise.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/promise_array.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/promisify.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/props.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/queue.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/race.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/reduce.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/schedule.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/settle.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/some.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/synchronous_inspection.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/thenables.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/timers.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/using.js","../webpack:/auto-changelog/node_modules/bluebird/js/release/util.js","../webpack:/auto-changelog/node_modules/deprecation/dist-node/index.js","../webpack:/auto-changelog/node_modules/generate-changelog/lib/file.js","../webpack:/auto-changelog/node_modules/generate-changelog/lib/git.js","../webpack:/auto-changelog/node_modules/generate-changelog/lib/index.js","../webpack:/auto-changelog/node_modules/generate-changelog/lib/package.js","../webpack:/auto-changelog/node_modules/generate-changelog/lib/writer.js","../webpack:/auto-changelog/node_modules/github-url-from-git/index.js","../webpack:/auto-changelog/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/auto-changeLine truncated
|
||||
{"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/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/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/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/wrappy/wrappy.js","../webpack:/auto-changelog/node_modules/@vercel/ncc/dist/ncc/@@notfound.js","../webpack:/auto-changelog/external \"assert\"","../webpack:/auto-changelog/external \"events\"","../webpack:/auto-changelog/external \"fs\"","../webpack:/auto-changelog/external \"http\"","../webpack:/auto-changelog/external \"https\"","../webpack:/auto-changelog/external \"net\"","../webpack:/auto-changelog/external \"os\"","../webpack:/auto-changelog/external \"path\"","../webpack:/auto-changelog/external \"stream\"","../webpack:/auto-changelog/external \"tls\"","../webpack:/auto-changelog/external \"url\"","../webpack:/auto-changelog/external \"util\"","../webpack:/auto-changelog/external \"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","octokit","exclude","owner","repo","tagRef","e_1","_a","_b","_c","_d","map","type","TYPES","repoUrl","commits","paginator","_e","paginate","repos","listCommits","per_page","_f","data","_g","sha","commit","message","category","title","flag","COMMIT_REGEX","exec","trim","other","undefined","replace","PR_REGEX","match","pull","RegExp","slice","push","e_1_1","error","return","values","filter","includes","sort","reduce","changelog","typeGroup","categories","keys","categoryGroup","defaultCategory","baseLine","join","breaking","build","ci","chore","docs","feat","fix","perf","refactor","revert","style","test","core_1","__webpack_require__","github_1","changelog_1","run","token","getInput","required","split","getOctokit","context","tags","listTags","info","setOutput","setFailed","__importStar","mod","__esModule","k","os","utils_1","issueCommand","command","properties","cmd","Command","process","stdout","write","toString","EOL","issue","name","CMD_STRING","[object Object]","cmdStr","first","key","val","escapeProperty","escapeData","toCommandValue","command_1","file_command_1","path","ExitCode","exportVariable","convertedVal","env","filePath","delimiter","commandValue","setSecret","secret","addPath","inputPath","options","toUpperCase","Error","setCommandEcho","enabled","exitCode","Failure","isDebug","debug","warning","startGroup","endGroup","group","fn","Line truncated
|
||||
@@ -425,31 +425,6 @@ Apache-2.0
|
||||
limitations under the License.
|
||||
|
||||
|
||||
bluebird
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2018 Petka Antonov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
deprecation
|
||||
ISC
|
||||
The ISC License
|
||||
@@ -469,58 +444,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
generate-changelog
|
||||
MIT
|
||||
Copyright (c) 2015 Lob.com
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
github-url-from-git
|
||||
MIT
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 TJ Holowaychuk <[email protected]>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
is-plain-object
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Generated
-31
@@ -208,12 +208,6 @@
|
||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/generate-changelog": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/generate-changelog/-/generate-changelog-1.8.0.tgz",
|
||||
"integrity": "sha512-JEpf0zZOuJHrHAiTOL8s9fP6uyvooJkxDoCUJFquWN9N9WyjU+14F1j0aDcn1Zc3PkdPwnQSUYlljv1UHgz8pQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/json-schema": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
|
||||
@@ -399,11 +393,6 @@
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
||||
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@@ -496,11 +485,6 @@
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
@@ -798,21 +782,6 @@
|
||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
||||
"dev": true
|
||||
},
|
||||
"generate-changelog": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/generate-changelog/-/generate-changelog-1.8.0.tgz",
|
||||
"integrity": "sha512-msgpxeB75Ziyg3wGsZuPNl7c5RxChMKmYcAX5obnhUow90dBZW3nLic6nxGtst7Bpx453oS6zAIHcX7F3QVasw==",
|
||||
"requires": {
|
||||
"bluebird": "^3.0.6",
|
||||
"commander": "^2.9.0",
|
||||
"github-url-from-git": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"github-url-from-git": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.5.0.tgz",
|
||||
"integrity": "sha1-+YX+3MCpqledyI16/waNVcxiUaA="
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
|
||||
+1
-3
@@ -33,11 +33,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^4.0.0",
|
||||
"generate-changelog": "^1.8.0"
|
||||
"@actions/github": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/generate-changelog": "^1.8.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
||||
"@typescript-eslint/parser": "^4.2.0",
|
||||
"@vercel/ncc": "^0.24.1",
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
import { GitHub } from "@actions/github/lib/utils";
|
||||
|
||||
export async function generate(
|
||||
octokit: InstanceType<typeof GitHub>,
|
||||
exclude: string[],
|
||||
owner: string,
|
||||
repo: string,
|
||||
tagRef?: string,
|
||||
): Promise<string> {
|
||||
exclude = exclude.map(
|
||||
(type) => (TYPES as { [type: string]: string | undefined })[type] ?? type,
|
||||
);
|
||||
|
||||
const repoUrl = `https://github.com/${owner}/${repo}`;
|
||||
const commits: Commits = {};
|
||||
|
||||
paginator: for await (const { data } of octokit.paginate.iterator(
|
||||
octokit.repos.listCommits,
|
||||
{
|
||||
per_page: 100,
|
||||
owner,
|
||||
repo,
|
||||
},
|
||||
)) {
|
||||
for (const { sha, ...commit } of data) {
|
||||
if (sha === tagRef) break paginator;
|
||||
|
||||
const message = commit.commit.message;
|
||||
|
||||
let [, type, category, title, flag] = COMMIT_REGEX.exec(message) || [];
|
||||
|
||||
if (!title) continue;
|
||||
|
||||
type = trim(type);
|
||||
type =
|
||||
(TYPES as { [type: string]: string | undefined })[type] ?? TYPES.other;
|
||||
|
||||
category = category ? trim(category) : "";
|
||||
|
||||
flag = trim(flag);
|
||||
if (flag !== "breaking") flag = undefined as never;
|
||||
|
||||
title = trim(title).replace(
|
||||
PR_REGEX,
|
||||
(match, pull) => `[${match}](${repoUrl}/pull/${pull})`,
|
||||
);
|
||||
if (flag) title = title.replace(new RegExp(` ?\\[${flag}\\]$`), "");
|
||||
title = `${title} ([${sha.slice(0, 8)}](${repoUrl}/commit/${sha}))`;
|
||||
if (flag) title += ` **[${flag}]**`;
|
||||
|
||||
commits[type] = commits[type] ?? {};
|
||||
commits[type][category] = commits[type][category] ?? [];
|
||||
commits[type][category].push(title);
|
||||
}
|
||||
}
|
||||
|
||||
return Object.values(TYPES)
|
||||
.filter((type) => !exclude.includes(type))
|
||||
.sort()
|
||||
.reduce((changelog, type) => {
|
||||
const typeGroup = commits[type];
|
||||
|
||||
if (typeGroup == null) return changelog;
|
||||
|
||||
changelog.push(`### ${type}`, "");
|
||||
|
||||
const categories = Object.keys(typeGroup).sort();
|
||||
|
||||
for (const category of categories) {
|
||||
const categoryGroup = typeGroup[category];
|
||||
const defaultCategory = category.length === 0;
|
||||
|
||||
if (!defaultCategory) changelog.push(`* **${category}:**`);
|
||||
|
||||
const baseLine = defaultCategory ? "" : " ";
|
||||
|
||||
for (const title of categoryGroup) {
|
||||
changelog.push(baseLine + "* " + title);
|
||||
}
|
||||
}
|
||||
|
||||
changelog.push("");
|
||||
|
||||
return changelog;
|
||||
}, [] as string[])
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function trim(value: string): string {
|
||||
if (value == null) return value;
|
||||
|
||||
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 / Dependencies",
|
||||
ci: "Continuous Integration",
|
||||
chore: "Chores",
|
||||
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 Commits {
|
||||
[type: string]: {
|
||||
[category: string]: string[];
|
||||
};
|
||||
}
|
||||
+5
-14
@@ -1,13 +1,11 @@
|
||||
import { info, getInput, setOutput, setFailed } from "@actions/core";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import Changelog from "generate-changelog";
|
||||
import { generate } from "./changelog";
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const token = getInput("token", { required: true });
|
||||
const exclude = getInput("exclude", { required: false }).split(",");
|
||||
const allowUnknown =
|
||||
getInput("allow-unknown", { required: false }) === "true";
|
||||
const octokit = getOctokit(token);
|
||||
const {
|
||||
repo: { owner, repo },
|
||||
@@ -20,22 +18,15 @@ async function run() {
|
||||
per_page: 2,
|
||||
});
|
||||
|
||||
let tag: string | undefined;
|
||||
let tagRef: string | undefined;
|
||||
|
||||
if (tags.length > 0) {
|
||||
if (sha === tags[0].commit.sha) {
|
||||
if (tags.length > 1) tag = tags[1].name;
|
||||
} else tag = tags[0].name;
|
||||
if (tags.length > 1) tagRef = tags[1].commit.sha;
|
||||
} else tagRef = tags[0].commit.sha;
|
||||
}
|
||||
|
||||
let changelog = await Changelog.generate({
|
||||
repoUrl: `https://github.com/${owner}/${repo}`,
|
||||
tag,
|
||||
exclude,
|
||||
allowUnknown,
|
||||
});
|
||||
|
||||
changelog = changelog.replace(/^#+ +(\d)/, "#### v$1");
|
||||
const changelog = await generate(octokit, exclude, owner, repo, tagRef);
|
||||
|
||||
info(changelog);
|
||||
|
||||
|
||||
Reference in new issue
Block a user