mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-10 00:10:06 +00:00
✨ only update option
This commit is contained in:
parent
fe2ab5edd2
commit
4b4f618262
7 changed files with 220 additions and 5 deletions
|
|
@ -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", {
|
||||
|
|
|
|||
10
src/main.ts
10
src/main.ts
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue