mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-08 15:30:05 +00:00
Don't create a comment with hide: true (#1661)
This commit is contained in:
parent
3bbec31446
commit
308b2fd250
2 changed files with 65 additions and 11 deletions
22
src/main.ts
22
src/main.ts
|
|
@ -50,6 +50,14 @@ async function run(): Promise<undefined> {
|
|||
throw new Error("delete and recreate cannot be both set to true")
|
||||
}
|
||||
|
||||
if (deleteOldComment && onlyCreateComment) {
|
||||
throw new Error("delete and only_create cannot be both set to true")
|
||||
}
|
||||
|
||||
if (deleteOldComment && hideOldComment) {
|
||||
throw new Error("delete and hide cannot be both set to true")
|
||||
}
|
||||
|
||||
if (onlyCreateComment && onlyUpdateComment) {
|
||||
throw new Error("only_create and only_update cannot be both set to true")
|
||||
}
|
||||
|
|
@ -63,15 +71,8 @@ async function run(): Promise<undefined> {
|
|||
|
||||
core.setOutput("previous_comment_id", previous?.id)
|
||||
|
||||
if (deleteOldComment) {
|
||||
if (previous) {
|
||||
await deleteComment(octokit, previous.id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (!previous) {
|
||||
if (onlyUpdateComment) {
|
||||
if (onlyUpdateComment || hideOldComment || deleteOldComment) {
|
||||
return
|
||||
}
|
||||
const created = await createComment(octokit, repo, pullRequestNumber, body, header)
|
||||
|
|
@ -90,6 +91,11 @@ async function run(): Promise<undefined> {
|
|||
return
|
||||
}
|
||||
|
||||
if (deleteOldComment) {
|
||||
await deleteComment(octokit, previous.id)
|
||||
return
|
||||
}
|
||||
|
||||
if (skipUnchanged && commentsEqual(body, previous.body || "", header)) {
|
||||
// don't recreate or update if the message is unchanged
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue