Skip to content

Commit

Permalink
fix: fix content output params.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Dec 9, 2022
1 parent 7f8ff30 commit 0f73405
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14102,7 +14102,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
var myToken=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('token');var octokit=(0,_actions_github__WEBPACK_IMPORTED_MODULE_0__.getOctokit)(myToken);function nodeBase64ToUtf8(data){return Buffer.from(data,"base64").toString("utf-8");}function getFileContents(_x){return _getFileContents.apply(this,arguments);}function _getFileContents(){_getFileContents=(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(/*#__PURE__*/(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().mark(function _callee2(branch){var _getInputs2,owner,repo,filepath,body,_yield$octokit$rest$r,data;return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_getInputs2=getInputs(),owner=_getInputs2.owner,repo=_getInputs2.repo,filepath=_getInputs2.filepath;_context2.prev=1;body={owner:owner,repo:repo,ref:branch,path:filepath};(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.startGroup)("\uD83D\uDC49 File Content Parameters:");(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.info)("\uD83D\uDC49 ".concat(JSON.stringify(body,null,2)));(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.endGroup)();_context2.next=8;return octokit.rest.repos.getContent(body);case 8:_yield$octokit$rest$r=_context2.sent;data=_yield$octokit$rest$r.data;return _context2.abrupt("return",data);case 13:_context2.prev=13;_context2.t0=_context2["catch"](1);(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.warning)("\uD83D\uDC49 Get File Contents: ".concat(_context2.t0 instanceof Error?_context2.t0.message:_context2.t0));return _context2.abrupt("return");case 17:case"end":return _context2.stop();}}},_callee2,null,[[1,13]]);}));return _getFileContents.apply(this,arguments);}function getBranch(){return _getBranch.apply(this,arguments);}function _getBranch(){_getBranch=(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(/*#__PURE__*/(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().mark(function _callee3(){var _getInputs3,branch,_yield$octokit$rest$r2,data;return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_getInputs3=getInputs(),branch=_getInputs3.branch;if(!(branch!==null)){_context3.next=3;break;}return _context3.abrupt("return",Promise.resolve(branch));case 3:_context3.next=5;return octokit.rest.repos.get(_actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo);case 5:_yield$octokit$rest$r2=_context3.sent;data=_yield$octokit$rest$r2.data;return _context3.abrupt("return",data.default_branch);case 8:case"end":return _context3.stop();}}},_callee3);}));return _getBranch.apply(this,arguments);}var getInputs=function getInputs(){var branch=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('branch');var filepath=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('path')||'';var localfile=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('localfile')||'';return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)((0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({},_actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo),{},{filepath:filepath,branch:branch,localfile:localfile});};(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(/*#__PURE__*/(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().mark(function _callee(){var _getInputs,localfile,branch,currentFilePath,content,stat,currentFile,fileContent;return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_getInputs=getInputs(),localfile=_getInputs.localfile;_context.next=3;return getBranch();case 3:branch=_context.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.info)("\uD83D\uDC49 branch: (".concat(branch||'-',")"));if(!localfile){_context.next=17;break;}currentFilePath=path__WEBPACK_IMPORTED_MODULE_2___default().resolve(localfile);(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.info)("\uD83D\uDC49 LocalFile: (".concat(currentFilePath||'-',")"));_context.next=10;return fs_extra__WEBPACK_IMPORTED_MODULE_6___default().readFile(currentFilePath);case 10:content=_context.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput)('content',content);// * dev: 2114n,
var myToken=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('token');var octokit=(0,_actions_github__WEBPACK_IMPORTED_MODULE_0__.getOctokit)(myToken);function nodeBase64ToUtf8(data){return Buffer.from(data,"base64").toString("utf-8");}function getFileContents(_x){return _getFileContents.apply(this,arguments);}function _getFileContents(){_getFileContents=(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(/*#__PURE__*/(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().mark(function _callee2(branch){var _getInputs2,owner,repo,filepath,body,_yield$octokit$rest$r,data;return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_getInputs2=getInputs(),owner=_getInputs2.owner,repo=_getInputs2.repo,filepath=_getInputs2.filepath;_context2.prev=1;body={owner:owner,repo:repo,ref:branch,path:filepath};(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.startGroup)("\uD83D\uDC49 File Content Parameters:");(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.info)("\uD83D\uDC49 ".concat(JSON.stringify(body,null,2)));(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.endGroup)();_context2.next=8;return octokit.rest.repos.getContent(body);case 8:_yield$octokit$rest$r=_context2.sent;data=_yield$octokit$rest$r.data;return _context2.abrupt("return",data);case 13:_context2.prev=13;_context2.t0=_context2["catch"](1);(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.warning)("\uD83D\uDC49 Get File Contents: ".concat(_context2.t0 instanceof Error?_context2.t0.message:_context2.t0));return _context2.abrupt("return");case 17:case"end":return _context2.stop();}}},_callee2,null,[[1,13]]);}));return _getFileContents.apply(this,arguments);}function getBranch(){return _getBranch.apply(this,arguments);}function _getBranch(){_getBranch=(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(/*#__PURE__*/(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().mark(function _callee3(){var _getInputs3,branch,_yield$octokit$rest$r2,data;return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_getInputs3=getInputs(),branch=_getInputs3.branch;if(!(branch!==null)){_context3.next=3;break;}return _context3.abrupt("return",Promise.resolve(branch));case 3:_context3.next=5;return octokit.rest.repos.get(_actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo);case 5:_yield$octokit$rest$r2=_context3.sent;data=_yield$octokit$rest$r2.data;return _context3.abrupt("return",data.default_branch);case 8:case"end":return _context3.stop();}}},_callee3);}));return _getBranch.apply(this,arguments);}var getInputs=function getInputs(){var branch=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('branch');var filepath=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('path')||'';var localfile=(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput)('localfile')||'';return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)((0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({},_actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo),{},{filepath:filepath,branch:branch,localfile:localfile});};(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(/*#__PURE__*/(0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().mark(function _callee(){var _getInputs,localfile,branch,currentFilePath,content,stat,currentFile,fileContent;return (0,_Users_wangchujiang_git_project_actions_github_action_read_file_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_getInputs=getInputs(),localfile=_getInputs.localfile;_context.next=3;return getBranch();case 3:branch=_context.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.info)("\uD83D\uDC49 branch: (".concat(branch||'-',")"));if(!localfile){_context.next=17;break;}currentFilePath=path__WEBPACK_IMPORTED_MODULE_2___default().resolve(localfile);(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.info)("\uD83D\uDC49 LocalFile: (".concat(currentFilePath||'-',")"));_context.next=10;return fs_extra__WEBPACK_IMPORTED_MODULE_6___default().readFile(currentFilePath);case 10:content=_context.sent;(0,_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput)('content',content.toString());// * dev: 2114n,
// * ino: 48064969n,
// * mode: 33188n,
// * nlink: 1n,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getInputs = () => {
const currentFilePath = path.resolve(localfile)
info(`👉 LocalFile: (${currentFilePath || '-'})`);
const content = await fs.readFile(currentFilePath)
setOutput('content', content);
setOutput('content', content.toString());
// * dev: 2114n,
// * ino: 48064969n,
// * mode: 33188n,
Expand Down

0 comments on commit 0f73405

Please sign in to comment.