update @octokit/graphql-schema

This commit is contained in:
marocchino 2025-04-09 20:16:22 +09:00
parent 52423e0164
commit e24be28b0d
No known key found for this signature in database
GPG key ID: F54107506CCF18D0
7 changed files with 638 additions and 681 deletions

View file

@ -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)

View file

@ -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"

View file

@ -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(