diff --git a/lib/index.js b/lib/index.js index cd86a4d..8ad6bac 100644 --- a/lib/index.js +++ b/lib/index.js @@ -12954,7 +12954,7 @@ var htmlEncoding=function htmlEncoding(string){return String(string).replace(/>/ */_context2.next=3;return octokit.paginate(octokit.rest.repos.listContributors,{owner:this.owner,repo:this.repo,per_page:this.options.count||100});case 3:list=_context2.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors UserInfo: (".concat(list===null||list===void 0?void 0:list.length,") \x1B[34m(GET /repos/").concat(this.owner,"/").concat(this.repo,"/contributors)\x1B[0m"));list.forEach(function(userInfoDetail){(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(JSON.stringify(userInfoDetail,null,2)));});(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();if(list&&list.length>0){userData=[];list.filter(function(el){return el.type==='Bot'||el.login.includes('actions-user');}).forEach(function(item){return _this.dataBot.push(item);});if(this.options.filterAuthor){userData=list.filter(function(item){return!new RegExp(_this.options.filterAuthor).test(item.login);});}if(this.options.excludeBots){userData=list.filter(function(el){return el.type!=='Bot'&&!el.login.includes('actions-user');});}if(Array.isArray(this.data)){this.data=userData;}}/** * collaborators of the repo * https://docs.github.com/cn/rest/collaborators/collaborators - */_context2.next=10;return octokit.paginate(octokit.rest.repos.listCollaborators,{owner:this.owner,repo:this.repo,affiliation:this.options.collaborators,per_page:this.options.count||100});case 10:collaboratorsList=_context2.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators UserInfo: \x1B[34m(GET /repos/".concat(this.owner,"/").concat(this.repo,"/collaborators)\x1B[0m"));collaboratorsList.forEach(function(userInfoDetail){(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(JSON.stringify(userInfoDetail,null,2)));});(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();if(collaboratorsList&&collaboratorsList.length>0){_userData=[];collaboratorsList.filter(function(el){return el.type==='Bot'||el.login.includes('actions-user');}).forEach(function(item){return _this.dataBotCollaborators.push(item);});if(this.options.filterAuthor){_userData=collaboratorsList.filter(function(item){return!new RegExp(_this.options.filterAuthor).test(item.login);});}if(this.options.excludeBots){_userData=collaboratorsList.filter(function(el){return el.type!=='Bot'&&!el.login.includes('actions-user');});}if(Array.isArray(this.data)){this.dataCollaborators=_userData;}}case 15:case"end":return _context2.stop();}}},_callee2,this);}));function getContributors(){return _getContributors.apply(this,arguments);}return getContributors;}()},{key:"generator",value:function(){var _generator=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4(){var _this2=this;var avatar,contributorsHeight;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return Promise.all(this.data.map(/*#__PURE__*/function(){var _ref=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(item,idx){var _getItemBBox,x,y,width,height,img;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Commit: \x1B[34m(".concat(item.login,")\x1B[0m"));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(JSON.stringify(item,null,2)));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();_getItemBBox=getItemBBox(idx,_this2.options),x=_getItemBBox.x,y=_getItemBBox.y,width=_getItemBBox.width,height=_getItemBBox.height;_context3.next=6;return image2uri__WEBPACK_IMPORTED_MODULE_5___default()(item.avatar_url,{ext:'.apng'});case 6:img=_context3.sent;return _context3.abrupt("return","\n\n"));case 8:case"end":return _context3.stop();}}},_callee3);}));return function(_x2,_x3){return _ref.apply(this,arguments);};}()));case 2:avatar=_context4.sent;contributorsHeight=calcSectionHeight(this.data.length,this.options);this.svg=this.options.svgTemplate.replace('{{ width }}',String(this.options.svgWidth)).replace('{{ contributorsHeight }}',String(contributorsHeight)).replace('{{{ contributors }}}',avatar.join(''));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('svg',this.svg);return _context4.abrupt("return",this.svg);case 7:case"end":return _context4.stop();}}},_callee4,this);}));function generator(){return _generator.apply(this,arguments);}return generator;}()},{key:"getHTMLStr",value:function(){var _getHTMLStr=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee5(data){var colCount,htmlTable,htmlList,idx,item,_yield$this$getUserIn,name,nikename;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:colCount=getColCount(this.options);htmlTable="\n\n";htmlList="\n";idx=0;case 4:if(!(idx\n";}_context5.next=9;return this.getUserInfo(item.login);case 9:_yield$this$getUserIn=_context5.sent;name=_yield$this$getUserIn.name;nikename=name||item.name||item.login;htmlTable+=" \n";htmlList+="\n");htmlList+=" \"").concat(nikename,"\"/\n");htmlList+="\n";case 21:idx++;_context5.next=4;break;case 24:htmlTable+="
\n";htmlTable+=" \n");htmlTable+=" \"").concat(nikename,"\"/\n");if(!this.options.hideName){htmlTable+="
".concat(nikename,"\n");}htmlTable+="
\n";htmlTable+="
\n\n";htmlList+='\n';if((data===null||data===void 0?void 0:data.length)===0){htmlTable='';htmlList='';}return _context5.abrupt("return",{htmlList:htmlList,htmlTable:htmlTable,colCount:colCount});case 28:case"end":return _context5.stop();}}},_callee5,this);}));function getHTMLStr(_x4){return _getHTMLStr.apply(this,arguments);}return getHTMLStr;}()},{key:"outputMarkdown",value:function(){var _outputMarkdown=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee6(){var _yield$this$getHTMLSt,htmlList,htmlTable,colCount,_yield$this$getHTMLSt2,htmlListBots,htmlTableBots,colCountBots,_yield$this$getHTMLSt3,htmlCollaboratorsList,htmlCollaboratorsTable,collaboratorsColCount,_yield$this$getHTMLSt4,htmlCollaboratorsListBots,htmlCollaboratorsTableBots,collaboratorsColCountBots;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.next=2;return this.getHTMLStr(this.data);case 2:_yield$this$getHTMLSt=_context6.sent;htmlList=_yield$this$getHTMLSt.htmlList;htmlTable=_yield$this$getHTMLSt.htmlTable;colCount=_yield$this$getHTMLSt.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors : \x1B[34m(htmlTable)\x1B[0m ".concat(colCount));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlTable));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlTable',htmlTable);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors : \x1B[34m(htmlList)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlList));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlList',htmlList);/** Contributors Bots */_context6.next=16;return this.getHTMLStr(this.dataBot);case 16:_yield$this$getHTMLSt2=_context6.sent;htmlListBots=_yield$this$getHTMLSt2.htmlList;htmlTableBots=_yield$this$getHTMLSt2.htmlTable;colCountBots=_yield$this$getHTMLSt2.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors Bots: \x1B[34m(htmlListBots)\x1B[0m ".concat(colCountBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlListBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlListBots',htmlListBots);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors Bots: \x1B[34m(htmlTableBots)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlTableBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlTableBots',htmlTableBots);/** Collaborators */_context6.next=30;return this.getHTMLStr(this.dataCollaborators);case 30:_yield$this$getHTMLSt3=_context6.sent;htmlCollaboratorsList=_yield$this$getHTMLSt3.htmlList;htmlCollaboratorsTable=_yield$this$getHTMLSt3.htmlTable;collaboratorsColCount=_yield$this$getHTMLSt3.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators : \x1B[34m(htmlCollaboratorsTable)\x1B[0m ".concat(collaboratorsColCount));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsTable));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsTable',htmlCollaboratorsTable);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators : \x1B[34m(htmlCollaboratorsList)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsList));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsList',htmlCollaboratorsList);/** Collaborators Bots */_context6.next=44;return this.getHTMLStr(this.dataBotCollaborators);case 44:_yield$this$getHTMLSt4=_context6.sent;htmlCollaboratorsListBots=_yield$this$getHTMLSt4.htmlList;htmlCollaboratorsTableBots=_yield$this$getHTMLSt4.htmlTable;collaboratorsColCountBots=_yield$this$getHTMLSt4.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators Bots: \x1B[34m(htmlCollaboratorsListBots)\x1B[0m ".concat(collaboratorsColCountBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsListBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsListBots',htmlCollaboratorsListBots);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators Bots: \x1B[34m(htmlCollaboratorsTableBots)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsTableBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsTableBots',htmlCollaboratorsTableBots);case 56:case"end":return _context6.stop();}}},_callee6,this);}));function outputMarkdown(){return _outputMarkdown.apply(this,arguments);}return outputMarkdown;}()},{key:"writeFile",value:function(){var _writeFile=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee7(){var data;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:if(!this.options.svgPath){_context7.next=5;break;}data=new Uint8Array(Buffer.from(this.svg));_context7.next=4;return fs__WEBPACK_IMPORTED_MODULE_2___default().promises.writeFile(this.options.svgPath,data);case 4:(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("Generated: \"".concat(this.options.svgPath,"\""));case 5:case"end":return _context7.stop();}}},_callee7,this);}));function writeFile(){return _writeFile.apply(this,arguments);}return writeFile;}()}]);return Generator;}();try{;(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee8(){var gen;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:gen=new Generator();_context8.next=3;return gen.getContributors();case 3:_context8.next=5;return gen.generator();case 5:_context8.next=7;return gen.outputMarkdown();case 7:_context8.next=9;return gen.writeFile();case 9:case"end":return _context8.stop();}}},_callee8);}))();}catch(error){(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setFailed)(error.message);} + */_context2.next=10;return octokit.paginate(octokit.rest.repos.listCollaborators,{owner:this.owner,repo:this.repo,affiliation:this.options.collaborators,per_page:this.options.count||100});case 10:collaboratorsList=_context2.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators UserInfo: (".concat(collaboratorsList===null||collaboratorsList===void 0?void 0:collaboratorsList.length,") \x1B[34m(GET /repos/").concat(this.owner,"/").concat(this.repo,"/collaborators)\x1B[0m"));collaboratorsList.forEach(function(userInfoDetail){(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(JSON.stringify(userInfoDetail,null,2)));});(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();if(collaboratorsList&&collaboratorsList.length>0){_userData=[];collaboratorsList.filter(function(el){return el.type==='Bot'||el.login.includes('actions-user');}).forEach(function(item){return _this.dataBotCollaborators.push(item);});if(this.options.filterAuthor){_userData=collaboratorsList.filter(function(item){return!new RegExp(_this.options.filterAuthor).test(item.login);});}if(this.options.excludeBots){_userData=collaboratorsList.filter(function(el){return el.type!=='Bot'&&!el.login.includes('actions-user');});}if(Array.isArray(this.data)){this.dataCollaborators=_userData;}}case 15:case"end":return _context2.stop();}}},_callee2,this);}));function getContributors(){return _getContributors.apply(this,arguments);}return getContributors;}()},{key:"generator",value:function(){var _generator=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4(){var _this2=this;var avatar,contributorsHeight;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return Promise.all(this.data.map(/*#__PURE__*/function(){var _ref=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(item,idx){var _getItemBBox,x,y,width,height,img;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Commit: \x1B[34m(".concat(item.login,")\x1B[0m"));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(JSON.stringify(item,null,2)));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();_getItemBBox=getItemBBox(idx,_this2.options),x=_getItemBBox.x,y=_getItemBBox.y,width=_getItemBBox.width,height=_getItemBBox.height;_context3.next=6;return image2uri__WEBPACK_IMPORTED_MODULE_5___default()(item.avatar_url,{ext:'.apng'});case 6:img=_context3.sent;return _context3.abrupt("return","\n\n"));case 8:case"end":return _context3.stop();}}},_callee3);}));return function(_x2,_x3){return _ref.apply(this,arguments);};}()));case 2:avatar=_context4.sent;contributorsHeight=calcSectionHeight(this.data.length,this.options);this.svg=this.options.svgTemplate.replace('{{ width }}',String(this.options.svgWidth)).replace('{{ contributorsHeight }}',String(contributorsHeight)).replace('{{{ contributors }}}',avatar.join(''));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('svg',this.svg);return _context4.abrupt("return",this.svg);case 7:case"end":return _context4.stop();}}},_callee4,this);}));function generator(){return _generator.apply(this,arguments);}return generator;}()},{key:"getHTMLStr",value:function(){var _getHTMLStr=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee5(data){var colCount,htmlTable,htmlList,idx,item,_yield$this$getUserIn,name,nikename;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:colCount=getColCount(this.options);htmlTable="\n\n";htmlList="\n";idx=0;case 4:if(!(idx\n";}_context5.next=9;return this.getUserInfo(item.login);case 9:_yield$this$getUserIn=_context5.sent;name=_yield$this$getUserIn.name;nikename=name||item.name||item.login;htmlTable+=" \n";htmlList+="\n");htmlList+=" \"").concat(nikename,"\"/\n");htmlList+="\n";case 21:idx++;_context5.next=4;break;case 24:htmlTable+="
\n";htmlTable+=" \n");htmlTable+=" \"").concat(nikename,"\"/\n");if(!this.options.hideName){htmlTable+="
".concat(nikename,"\n");}htmlTable+="
\n";htmlTable+="
\n\n";htmlList+='\n';if((data===null||data===void 0?void 0:data.length)===0){htmlTable='';htmlList='';}return _context5.abrupt("return",{htmlList:htmlList,htmlTable:htmlTable,colCount:colCount});case 28:case"end":return _context5.stop();}}},_callee5,this);}));function getHTMLStr(_x4){return _getHTMLStr.apply(this,arguments);}return getHTMLStr;}()},{key:"outputMarkdown",value:function(){var _outputMarkdown=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee6(){var _yield$this$getHTMLSt,htmlList,htmlTable,colCount,_yield$this$getHTMLSt2,htmlListBots,htmlTableBots,colCountBots,_yield$this$getHTMLSt3,htmlCollaboratorsList,htmlCollaboratorsTable,collaboratorsColCount,_yield$this$getHTMLSt4,htmlCollaboratorsListBots,htmlCollaboratorsTableBots,collaboratorsColCountBots;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.next=2;return this.getHTMLStr(this.data);case 2:_yield$this$getHTMLSt=_context6.sent;htmlList=_yield$this$getHTMLSt.htmlList;htmlTable=_yield$this$getHTMLSt.htmlTable;colCount=_yield$this$getHTMLSt.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors : \x1B[34m(htmlTable)\x1B[0m ".concat(colCount));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlTable));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlTable',htmlTable);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors : \x1B[34m(htmlList)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlList));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlList',htmlList);/** Contributors Bots */_context6.next=16;return this.getHTMLStr(this.dataBot);case 16:_yield$this$getHTMLSt2=_context6.sent;htmlListBots=_yield$this$getHTMLSt2.htmlList;htmlTableBots=_yield$this$getHTMLSt2.htmlTable;colCountBots=_yield$this$getHTMLSt2.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors Bots: \x1B[34m(htmlListBots)\x1B[0m ".concat(colCountBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlListBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlListBots',htmlListBots);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Contributors Bots: \x1B[34m(htmlTableBots)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlTableBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlTableBots',htmlTableBots);/** Collaborators */_context6.next=30;return this.getHTMLStr(this.dataCollaborators);case 30:_yield$this$getHTMLSt3=_context6.sent;htmlCollaboratorsList=_yield$this$getHTMLSt3.htmlList;htmlCollaboratorsTable=_yield$this$getHTMLSt3.htmlTable;collaboratorsColCount=_yield$this$getHTMLSt3.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators : \x1B[34m(htmlCollaboratorsTable)\x1B[0m ".concat(collaboratorsColCount));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsTable));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsTable',htmlCollaboratorsTable);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators : \x1B[34m(htmlCollaboratorsList)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsList));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsList',htmlCollaboratorsList);/** Collaborators Bots */_context6.next=44;return this.getHTMLStr(this.dataBotCollaborators);case 44:_yield$this$getHTMLSt4=_context6.sent;htmlCollaboratorsListBots=_yield$this$getHTMLSt4.htmlList;htmlCollaboratorsTableBots=_yield$this$getHTMLSt4.htmlTable;collaboratorsColCountBots=_yield$this$getHTMLSt4.colCount;(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators Bots: \x1B[34m(htmlCollaboratorsListBots)\x1B[0m ".concat(collaboratorsColCountBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsListBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsListBots',htmlCollaboratorsListBots);(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.startGroup)("Collaborators Bots: \x1B[34m(htmlCollaboratorsTableBots)\x1B[0m");(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("".concat(htmlCollaboratorsTableBots));(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.endGroup)();(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setOutput)('htmlCollaboratorsTableBots',htmlCollaboratorsTableBots);case 56:case"end":return _context6.stop();}}},_callee6,this);}));function outputMarkdown(){return _outputMarkdown.apply(this,arguments);}return outputMarkdown;}()},{key:"writeFile",value:function(){var _writeFile=(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee7(){var data;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:if(!this.options.svgPath){_context7.next=5;break;}data=new Uint8Array(Buffer.from(this.svg));_context7.next=4;return fs__WEBPACK_IMPORTED_MODULE_2___default().promises.writeFile(this.options.svgPath,data);case 4:(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.info)("Generated: \"".concat(this.options.svgPath,"\""));case 5:case"end":return _context7.stop();}}},_callee7,this);}));function writeFile(){return _writeFile.apply(this,arguments);}return writeFile;}()}]);return Generator;}();try{;(0,_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(/*#__PURE__*/_Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee8(){var gen;return _Users_wangchujiang_git_project_actions_github_action_contributors_node_modules_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:gen=new Generator();_context8.next=3;return gen.getContributors();case 3:_context8.next=5;return gen.generator();case 5:_context8.next=7;return gen.outputMarkdown();case 7:_context8.next=9;return gen.writeFile();case 9:case"end":return _context8.stop();}}},_callee8);}))();}catch(error){(0,_actions_core__WEBPACK_IMPORTED_MODULE_3__.setFailed)(error.message);} })(); module.exports = __webpack_exports__; diff --git a/src/index.ts b/src/index.ts index f92e016..db449dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -155,7 +155,7 @@ class Generator { per_page: this.options.count || 100 }); - startGroup(`Collaborators UserInfo: \x1b[34m(GET /repos/${this.owner}/${this.repo}/collaborators)\x1b[0m`); + startGroup(`Collaborators UserInfo: (${collaboratorsList?.length}) \x1b[34m(GET /repos/${this.owner}/${this.repo}/collaborators)\x1b[0m`); collaboratorsList.forEach((userInfoDetail) => { info(`${JSON.stringify(userInfoDetail, null, 2)}`); })