@@ -9685,6 +9685,7 @@ var __webpack_exports__ = {};
96859685// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
96869686(() => {
96879687const { inspect } = __nccwpck_require__(3837);
9688+ const { readFileSync, existsSync } = __nccwpck_require__(7147);
96889689const core = __nccwpck_require__(2186);
96899690const github = __nccwpck_require__(5438);
96909691
@@ -9749,6 +9750,16 @@ async function addReactions(octokit, repo, comment_id, reactions) {
97499750 results = undefined;
97509751}
97519752
9753+ function getBody(inputs) {
9754+ if (inputs.body) {
9755+ return inputs.body;
9756+ } else if (inputs.bodyFile) {
9757+ return readFileSync(inputs.bodyFile, 'utf-8');
9758+ } else {
9759+ return '';
9760+ }
9761+ }
9762+
97529763async function run() {
97539764 try {
97549765 const inputs = {
@@ -9757,6 +9768,7 @@ async function run() {
97579768 issueNumber: core.getInput("issue-number"),
97589769 commentId: core.getInput("comment-id"),
97599770 body: core.getInput("body"),
9771+ bodyFile: core.getInput("body-file"),
97609772 editMode: core.getInput("edit-mode"),
97619773 reactions: core.getInput("reactions")
97629774 ? core.getInput("reactions")
@@ -9777,16 +9789,30 @@ async function run() {
97779789 return;
97789790 }
97799791
9792+ if (inputs.bodyFile && inputs.body) {
9793+ core.setFailed("Only one of 'body' or 'body-file' can be set.");
9794+ return;
9795+ }
9796+
9797+ if (inputs.bodyFile) {
9798+ if (!existsSync(inputs.bodyFile)) {
9799+ core.setFailed(`File '${inputs.bodyFile}' does not exist.`);
9800+ return;
9801+ }
9802+ }
9803+
9804+ const body = getBody(inputs);
9805+
97809806 const octokit = github.getOctokit(inputs.token);
97819807
97829808 if (inputs.commentId) {
97839809 // Edit a comment
9784- if (!inputs. body && !inputs.reactions) {
9785- core.setFailed("Missing either comment 'body' or 'reactions'.");
9810+ if (!body && !inputs.reactions) {
9811+ core.setFailed("Missing comment 'body', 'body-file', or 'reactions'.");
97869812 return;
97879813 }
97889814
9789- if (inputs. body) {
9815+ if (body) {
97909816 var commentBody = "";
97919817 if (editMode == "append") {
97929818 // Get the comment body
@@ -9798,7 +9824,7 @@ async function run() {
97989824 commentBody = comment.body + "\n";
97999825 }
98009826
9801- commentBody = commentBody + inputs. body;
9827+ commentBody = commentBody + body;
98029828 core.debug(`Comment body: ${commentBody}`);
98039829 await octokit.rest.issues.updateComment({
98049830 owner: repo[0],
@@ -9816,15 +9842,16 @@ async function run() {
98169842 }
98179843 } else if (inputs.issueNumber) {
98189844 // Create a comment
9819- if (!inputs. body) {
9820- core.setFailed("Missing comment 'body'.");
9845+ if (!body) {
9846+ core.setFailed("Missing comment 'body' or 'body-file' .");
98219847 return;
98229848 }
9849+
98239850 const { data: comment } = await octokit.rest.issues.createComment({
98249851 owner: repo[0],
98259852 repo: repo[1],
98269853 issue_number: inputs.issueNumber,
9827- body: inputs.body ,
9854+ body,
98289855 });
98299856 core.info(
98309857 `Created comment id '${comment.id}' on issue '${inputs.issueNumber}'.`
0 commit comments