mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-14 01:56:52 +00:00
update @octokit/graphql-schema
This commit is contained in:
parent
52423e0164
commit
e24be28b0d
7 changed files with 638 additions and 681 deletions
|
|
@ -4,7 +4,7 @@ import {
|
|||
ReportedContentClassifiers,
|
||||
Repository,
|
||||
User
|
||||
} from "@octokit/graphql-schema"
|
||||
} from "@octokit/graphql-schema/schema.d"
|
||||
import {GitHub} from "@actions/github/lib/utils"
|
||||
|
||||
type CreateCommentResponse = Awaited<
|
||||
|
|
@ -174,7 +174,7 @@ export async function minimizeComment(
|
|||
}
|
||||
|
||||
export function getBodyOf(
|
||||
previous: {body: string},
|
||||
previous: {body?: string},
|
||||
append: boolean,
|
||||
hideDetails: boolean
|
||||
): string | undefined {
|
||||
|
|
@ -182,16 +182,16 @@ export function getBodyOf(
|
|||
return undefined
|
||||
}
|
||||
|
||||
if (!hideDetails) {
|
||||
if (!hideDetails || !previous.body) {
|
||||
return previous.body
|
||||
}
|
||||
|
||||
return previous.body?.replace(/(<details.*?)\s*\bopen\b(.*>)/g, "$1$2")
|
||||
return previous.body.replace(/(<details.*?)\s*\bopen\b(.*>)/g, "$1$2")
|
||||
}
|
||||
|
||||
export function commentsEqual(
|
||||
body: string,
|
||||
previous: string,
|
||||
previous: string | undefined,
|
||||
header: string
|
||||
): boolean {
|
||||
const newBody = bodyWithHeader(body, header)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as core from "@actions/core"
|
||||
import {ReportedContentClassifiers} from "@octokit/graphql-schema"
|
||||
import {ReportedContentClassifiers} from "@octokit/graphql-schema/schema.d"
|
||||
import {context} from "@actions/github"
|
||||
import {readFileSync} from "fs"
|
||||
import {create} from "@actions/glob"
|
||||
|
|
|
|||
|
|
@ -101,12 +101,16 @@ async function run(): Promise<undefined> {
|
|||
return
|
||||
}
|
||||
|
||||
if (skipUnchanged && commentsEqual(body, previous.body, header)) {
|
||||
if (skipUnchanged && commentsEqual(body, previous.body || "", header)) {
|
||||
// don't recreate or update if the message is unchanged
|
||||
return
|
||||
}
|
||||
|
||||
const previousBody = getBodyOf(previous, append, hideDetails)
|
||||
const previousBody = getBodyOf(
|
||||
{body: previous.body || ""},
|
||||
append,
|
||||
hideDetails
|
||||
)
|
||||
if (recreate) {
|
||||
await deleteComment(octokit, previous.id)
|
||||
const created = await createComment(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue