mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-14 12:31: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) {
|
function getBodyOf(previous, append, hideDetails) {
|
||||||
var _a;
|
|
||||||
if (!append) {
|
if (!append) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (!hideDetails) {
|
if (!hideDetails || !previous.body) {
|
||||||
return 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) {
|
function commentsEqual(body, previous, header) {
|
||||||
const newBody = bodyWithHeader(body, header);
|
const newBody = bodyWithHeader(body, header);
|
||||||
|
|
@ -418,11 +417,11 @@ function run() {
|
||||||
yield (0, comment_1.minimizeComment)(octokit, previous.id, config_1.hideClassify);
|
yield (0, comment_1.minimizeComment)(octokit, previous.id, config_1.hideClassify);
|
||||||
return;
|
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
|
// don't recreate or update if the message is unchanged
|
||||||
return;
|
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) {
|
if (config_1.recreate) {
|
||||||
yield (0, comment_1.deleteComment)(octokit, previous.id);
|
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);
|
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/core": "^1.11.1",
|
||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^6.0.0",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@octokit/graphql-schema": "^14.52.0"
|
"@octokit/graphql-schema": "^15.26.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {
|
||||||
ReportedContentClassifiers,
|
ReportedContentClassifiers,
|
||||||
Repository,
|
Repository,
|
||||||
User
|
User
|
||||||
} from "@octokit/graphql-schema"
|
} from "@octokit/graphql-schema/schema.d"
|
||||||
import {GitHub} from "@actions/github/lib/utils"
|
import {GitHub} from "@actions/github/lib/utils"
|
||||||
|
|
||||||
type CreateCommentResponse = Awaited<
|
type CreateCommentResponse = Awaited<
|
||||||
|
|
@ -174,7 +174,7 @@ export async function minimizeComment(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBodyOf(
|
export function getBodyOf(
|
||||||
previous: {body: string},
|
previous: {body?: string},
|
||||||
append: boolean,
|
append: boolean,
|
||||||
hideDetails: boolean
|
hideDetails: boolean
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
|
|
@ -182,16 +182,16 @@ export function getBodyOf(
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hideDetails) {
|
if (!hideDetails || !previous.body) {
|
||||||
return 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(
|
export function commentsEqual(
|
||||||
body: string,
|
body: string,
|
||||||
previous: string,
|
previous: string | undefined,
|
||||||
header: string
|
header: string
|
||||||
): boolean {
|
): boolean {
|
||||||
const newBody = bodyWithHeader(body, header)
|
const newBody = bodyWithHeader(body, header)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import * as core from "@actions/core"
|
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 {context} from "@actions/github"
|
||||||
import {readFileSync} from "fs"
|
import {readFileSync} from "fs"
|
||||||
import {create} from "@actions/glob"
|
import {create} from "@actions/glob"
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,16 @@ async function run(): Promise<undefined> {
|
||||||
return
|
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
|
// don't recreate or update if the message is unchanged
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const previousBody = getBodyOf(previous, append, hideDetails)
|
const previousBody = getBodyOf(
|
||||||
|
{body: previous.body || ""},
|
||||||
|
append,
|
||||||
|
hideDetails
|
||||||
|
)
|
||||||
if (recreate) {
|
if (recreate) {
|
||||||
await deleteComment(octokit, previous.id)
|
await deleteComment(octokit, previous.id)
|
||||||
const created = await createComment(
|
const created = await createComment(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue