feat: Use generate-changelog package

This commit is contained in:
Ardalan Amini committed 2020-09-28 15:46:55 +03:30
1 parent 886408e12f
commit 22d355a83e
6 files changed
+149 -10

No files matched your search

+1 -1
View File
@@ -1,2 +1,2 @@
require('./sourcemap-register.js');module.exports=(()=>{var __webpack_modules__={283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(186);const o=r(438);try{const e=s.getInput("token",{required:true});s.info(JSON.stringify(o.context.repo));s.setOutput("changelog","Changelog")}catch(e){s.setFailed(e.message)}},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){if(this.properties.hasOwnProperty(r)){const s=this.properties[r];if(s){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(s)}`}}}}e+=`${i}${escapeData(this.message)}`;return e}}function escapeData(e){return n.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return n.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},186: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())})};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 n=r(351);const i=r(717);const c=r(278);const a=o(r(87));const u=o(r(622));var p;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(p=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=c.toCommandValue(t);process.env[e]=r;const s=process.env["GITHUB_ENV"]||"";if(s){const t="_GitHubActionsFileCommandDelimeter_";const s=`${e}<<${t}${a.EOL}${r}${a.EOL}${t}`;i.issueCommand("ENV",s)}else{n.issueCommand("set-env",{name:e},r)}}t.exportVariable=exportVariable;function setSecret(e){n.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){i.issueCommand("PATH",e)}else{n.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){n.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){n.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=p.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){n.issueCommand("debug",{},e)}t.debug=debug;function error(e){n.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){n.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+a.EOL)}t.info=info;function startGroup(e){n.issue("group",e)}t.startGroup=startGroup;function endGroup(){n.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return s(this,void 0,void 0,function*(){startGroup(e);let r;try{r=yield t()}finally{endGroup()}return r})}t.group=group;function saveState(e,t){n.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}t.getState=getState},717: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(747));const n=s(r(87));const i=r(278);function issueCommand(e,t){const r=process.env[`GITHUB_${e}`];if(!r){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!o.existsSync(r)){throw new Error(`Missing file at path: ${r}`)}o.appendFileSync(r,`${i.toCommandValue(t)}${n.EOL}`,{encoding:"utf8"})}t.issueCommand=issueCommand},278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof eLine truncated
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=i.getOctokit(e);const{repo:{owner:r,repo:n},sha:o}=i.context;const{data:c}=yield t.repos.listTags({owner:r,repo:n,per_page:2});let u;if(c.length>0){if(o===c[0].commit.sha){if(c.length>1)u=c[1].name}else u=c[0].name}const l=yield a.default.generate({repoUrl:`https://github.com/${r}/${n}`,tag:u});s.info(l);s.setOutput("changelog",l)}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);let r;try{r=yield t()}finally{endGroup()}return r})}t.group=group;function saveState(e,t){s.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){returLine truncated
//# sourceMappingURL=index.js.map
+1 -1
View File
@@ -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/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":["Object","defineProperty","exports","value","core_1","__webpack_require__","github_1","token","getInput","required","info","JSON","stringify","context","repo","setOutput","error","setFailed","message","__importStar","this","mod","__esModule","result","k","hasOwnProperty","call","os","utils_1","issueCommand","command","properties","cmd","Command","process","stdout","write","toString","EOL","issue","name","CMD_STRING","[object Object]","cmdStr","keys","length","first","key","val","escapeProperty","escapeData","s","toCommandValue","replace","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","done","then","apply","command_1","file_command_1","path","ExitCode","exportVariable","convertedVal","env","filePath","delimiter","commandValue","setSecret","secret","addPath","inputPath","options","toUpperCase","Error","trim","setCommandEcho","enabled","exitCode","Failure","isDebug","debug","warning","startGroup","endGroup","group","fn","saveState","getState","fs","existsSync","appendFileSync","encoding","input","undefined","String","Context","fs_1","os_1","payload","GITHUB_EVENT_PATH","parse","readFileSync","eventName","GITHUB_EVENT_NAME","sha","GITHUB_SHA","ref","GITHUB_REF","workflow","GITHUB_WORKFLOW","action","GITHUB_ACTION","actor","GITHUB_ACTOR","job","GITHUB_JOB","runNumber","parseInt","GITHUB_RUN_NUMBER","runId","GITHUB_RUN_ID","assign","number","pull_request","GITHUB_REPOSITORY","owner","split","repository","login","__createBinding","create","o","m","k2","enumerable","get","__setModuleDefault","v","getOctokit","GitHub","getOctokitOptions","getApiBaseUrl","getProxyAgent","getAuthString","httpClient","auth","destinationUrl","hc","HttpClient","getAgent","Utils","plugin_rest_endpoint_methods_1","plugin_paginate_rest_1","baseUrl","defaults","request","agent","Octokit","pluginLine truncated
{"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
+77
View File
@@ -425,6 +425,31 @@ 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
@@ -444,6 +469,58 @@ 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)
+31
View File
@@ -208,6 +208,12 @@
"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",
@@ -393,6 +399,11 @@
"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",
@@ -485,6 +496,11 @@
"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",
@@ -782,6 +798,21 @@
"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",
+3 -1
View File
@@ -33,9 +33,11 @@
},
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/github": "^4.0.0"
"@actions/github": "^4.0.0",
"generate-changelog": "^1.8.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",
+36 -7
View File
@@ -1,12 +1,41 @@
import { info, getInput, setOutput, setFailed } from "@actions/core";
import { context } from "@actions/github";
import { context, getOctokit } from "@actions/github";
import Changelog from "generate-changelog";
try {
const token = getInput("token", { required: true });
async function run() {
try {
const token = getInput("token", { required: true });
const octokit = getOctokit(token);
const {
repo: { owner, repo },
sha,
} = context;
info(JSON.stringify(context.repo));
const { data: tags } = await octokit.repos.listTags({
owner,
repo,
per_page: 2,
});
setOutput("changelog", "Changelog");
} catch (error) {
setFailed(error.message);
let tag: 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;
}
const changelog = await Changelog.generate({
repoUrl: `https://github.com/${owner}/${repo}`,
tag,
});
info(changelog);
setOutput("changelog", changelog);
} catch (error) {
setFailed(error.message);
}
}
run();