only update option

This commit is contained in:
marocchino 2023-02-11 19:58:15 +09:00
parent fe2ab5edd2
commit 4b4f618262
No known key found for this signature in database
GPG key ID: DEFF05E6B5B0FF97
7 changed files with 220 additions and 5 deletions

View file

@ -25,6 +25,9 @@ export const deleteOldComment = core.getBooleanInput("delete", {required: true})
export const onlyCreateComment = core.getBooleanInput("only_create", {
required: true
})
export const onlyUpdateComment = core.getBooleanInput("only_update", {
required: true
})
export const hideOldComment = core.getBooleanInput("hide", {required: true})
export const githubToken = core.getInput("GITHUB_TOKEN", {required: true})
export const ignoreEmpty = core.getBooleanInput("ignore_empty", {

View file

@ -14,7 +14,8 @@ import {
recreate,
repo,
ignoreEmpty,
onlyCreateComment
onlyCreateComment,
onlyUpdateComment
} from "./config"
import {
createComment,
@ -47,6 +48,10 @@ async function run(): Promise<undefined> {
throw new Error("delete and recreate cannot be both set to true")
}
if (onlyCreateComment && onlyUpdateComment) {
throw new Error("only_create and only_update cannot be both set to true")
}
if (hideOldComment && hideAndRecreate) {
throw new Error("hide and hide_and_recreate cannot be both set to true")
}
@ -67,6 +72,9 @@ async function run(): Promise<undefined> {
}
if (!previous) {
if (onlyUpdateComment) {
return
}
await createComment(octokit, repo, pullRequestNumber, body, header)
return
}