Package changes

This commit is contained in:
Peter Evans 2020-03-28 08:56:01 +09:00
parent c8a511a6a7
commit 2ed53ed12f

40
dist/index.js vendored
View File

@ -551,26 +551,8 @@ async function run() {
}
const octokit = new github.GitHub(inputs.token);
if (inputs.issueNumber) {
// Create a comment
if (!inputs.body) {
core.setFailed("Missing comment 'body'.");
return;
}
const { data: comment } = await octokit.issues.createComment({
owner: repo[0],
repo: repo[1],
issue_number: inputs.issueNumber,
body: inputs.body
});
core.info(`Created comment on issue '${inputs.issueNumber}'.`);
// Set a comment reaction
if (inputs.reactionType) {
await addReaction(octokit, repo, comment.id, inputs.reactionType);
}
} else if (inputs.commentId) {
if (inputs.commentId) {
// Edit a comment
if (!inputs.body && !inputs.reactionType) {
core.setFailed("Missing either comment 'body' or 'reaction-type'.");
@ -604,6 +586,24 @@ async function run() {
if (inputs.reactionType) {
await addReaction(octokit, repo, inputs.commentId, inputs.reactionType);
}
} else if (inputs.issueNumber) {
// Create a comment
if (!inputs.body) {
core.setFailed("Missing comment 'body'.");
return;
}
const { data: comment } = await octokit.issues.createComment({
owner: repo[0],
repo: repo[1],
issue_number: inputs.issueNumber,
body: inputs.body
});
core.info(`Created comment on issue '${inputs.issueNumber}'.`);
// Set a comment reaction
if (inputs.reactionType) {
await addReaction(octokit, repo, comment.id, inputs.reactionType);
}
} else {
core.setFailed("Missing either 'issue-number' or 'comment-id'.");
return;