Skip to content

Commit 2ed53ed

Browse files
committed
Package changes
1 parent c8a511a commit 2ed53ed

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

dist/index.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -551,26 +551,8 @@ async function run() {
551551
}
552552

553553
const octokit = new github.GitHub(inputs.token);
554-
555-
if (inputs.issueNumber) {
556-
// Create a comment
557-
if (!inputs.body) {
558-
core.setFailed("Missing comment 'body'.");
559-
return;
560-
}
561-
const { data: comment } = await octokit.issues.createComment({
562-
owner: repo[0],
563-
repo: repo[1],
564-
issue_number: inputs.issueNumber,
565-
body: inputs.body
566-
});
567-
core.info(`Created comment on issue '${inputs.issueNumber}'.`);
568-
569-
// Set a comment reaction
570-
if (inputs.reactionType) {
571-
await addReaction(octokit, repo, comment.id, inputs.reactionType);
572-
}
573-
} else if (inputs.commentId) {
554+
555+
if (inputs.commentId) {
574556
// Edit a comment
575557
if (!inputs.body && !inputs.reactionType) {
576558
core.setFailed("Missing either comment 'body' or 'reaction-type'.");
@@ -604,6 +586,24 @@ async function run() {
604586
if (inputs.reactionType) {
605587
await addReaction(octokit, repo, inputs.commentId, inputs.reactionType);
606588
}
589+
} else if (inputs.issueNumber) {
590+
// Create a comment
591+
if (!inputs.body) {
592+
core.setFailed("Missing comment 'body'.");
593+
return;
594+
}
595+
const { data: comment } = await octokit.issues.createComment({
596+
owner: repo[0],
597+
repo: repo[1],
598+
issue_number: inputs.issueNumber,
599+
body: inputs.body
600+
});
601+
core.info(`Created comment on issue '${inputs.issueNumber}'.`);
602+
603+
// Set a comment reaction
604+
if (inputs.reactionType) {
605+
await addReaction(octokit, repo, comment.id, inputs.reactionType);
606+
}
607607
} else {
608608
core.setFailed("Missing either 'issue-number' or 'comment-id'.");
609609
return;

0 commit comments

Comments
 (0)