mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-13 12:11:14 +00:00
update @octokit/graphql-schema
This commit is contained in:
parent
52423e0164
commit
e24be28b0d
7 changed files with 638 additions and 681 deletions
9
dist/index.js
generated
vendored
9
dist/index.js
generated
vendored
|
|
@ -176,14 +176,13 @@ function minimizeComment(octokit, subjectId, classifier) {
|
|||
});
|
||||
}
|
||||
function getBodyOf(previous, append, hideDetails) {
|
||||
var _a;
|
||||
if (!append) {
|
||||
return undefined;
|
||||
}
|
||||
if (!hideDetails) {
|
||||
if (!hideDetails || !previous.body) {
|
||||
return previous.body;
|
||||
}
|
||||
return (_a = previous.body) === null || _a === void 0 ? void 0 : _a.replace(/(<details.*?)\s*\bopen\b(.*>)/g, "$1$2");
|
||||
return previous.body.replace(/(<details.*?)\s*\bopen\b(.*>)/g, "$1$2");
|
||||
}
|
||||
function commentsEqual(body, previous, header) {
|
||||
const newBody = bodyWithHeader(body, header);
|
||||
|
|
@ -418,11 +417,11 @@ function run() {
|
|||
yield (0, comment_1.minimizeComment)(octokit, previous.id, config_1.hideClassify);
|
||||
return;
|
||||
}
|
||||
if (config_1.skipUnchanged && (0, comment_1.commentsEqual)(body, previous.body, config_1.header)) {
|
||||
if (config_1.skipUnchanged && (0, comment_1.commentsEqual)(body, previous.body || "", config_1.header)) {
|
||||
// don't recreate or update if the message is unchanged
|
||||
return;
|
||||
}
|
||||
const previousBody = (0, comment_1.getBodyOf)(previous, config_1.append, config_1.hideDetails);
|
||||
const previousBody = (0, comment_1.getBodyOf)({ body: previous.body || "" }, config_1.append, config_1.hideDetails);
|
||||
if (config_1.recreate) {
|
||||
yield (0, comment_1.deleteComment)(octokit, previous.id);
|
||||
const created = yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header, previousBody);
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -29,7 +29,7 @@
|
|||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/glob": "^0.5.0",
|
||||
"@octokit/graphql-schema": "^14.52.0"
|
||||
"@octokit/graphql-schema": "^15.26.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
|
|
|
|||
|
|
@ -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…
Reference in a new issue