QFIX: Github migration + few checks (#9244)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-06-16 01:38:10 +07:00
committed by GitHub
parent 0334bd2b30
commit 35dcda4364
9 changed files with 143 additions and 77 deletions
+34 -26
View File
@@ -328,16 +328,19 @@ export class CommentSyncManager implements DocSyncManager {
if (Object.keys(platformUpdate).length > 0) {
// Check and update body with external
const okit = (await this.provider.getOctokit(existing.modifiedBy)) ?? container.container.octokit
await okit?.rest.issues.updateComment({
owner: repository.owner?.login as string,
repo: repository.name,
issue_number: parent.githubNumber,
comment_id: comment.id,
body: await this.provider.getMarkdown(existingComment.message),
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
const mdown = await this.provider.getMarkdown(existingComment.message)
if (mdown.trim().length > 0) {
await okit?.rest.issues.updateComment({
owner: repository.owner?.login as string,
repo: repository.name,
issue_number: parent.githubNumber,
comment_id: comment.id,
body: mdown,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
}
}
if (Object.keys(update).length > 0) {
await this.client.update(existing, update, false, new Date(comment.updated_at).getTime(), account)
@@ -400,24 +403,29 @@ export class CommentSyncManager implements DocSyncManager {
// No external version yet, create it.
try {
const result = await okit?.rest.issues.createComment({
owner: repo.owner?.login as string,
repo: repo.name,
issue_number: parent.githubNumber,
body: await this.provider.getMarkdown(chatMessage.message),
headers: {
'X-GitHub-Api-Version': '2022-11-28'
const mdown = await this.provider.getMarkdown(chatMessage.message)
if (mdown.trim().length > 0) {
const result = await okit?.rest.issues.createComment({
owner: repo.owner?.login as string,
repo: repo.name,
issue_number: parent.githubNumber,
body: mdown,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
const upd: DocumentUpdate<DocSyncInfo> = {
parent: (result?.data.html_url?.split('#')?.[0] ?? '').toLowerCase(),
url: (result?.data.url ?? '').toLowerCase(),
external: result?.data as CommentExternalData,
current: result?.data,
repository: repo._id
}
})
const upd: DocumentUpdate<DocSyncInfo> = {
parent: (result?.data.html_url?.split('#')?.[0] ?? '').toLowerCase(),
url: (result?.data.url ?? '').toLowerCase(),
external: result?.data as CommentExternalData,
current: result?.data,
repository: repo._id
// We need to update in current promise, to prevent event changes.
await derivedClient.update(info, upd)
}
// We need to update in current promise, to prevent event changes.
await derivedClient.update(info, upd)
return {}
} catch (err: any) {
Analytics.handleError(err)
@@ -99,7 +99,7 @@ export abstract class IssueSyncManagerBase {
// Find Assignees and reviewers
const assignees: PersonId[] = []
for (const o of issue.assignees.nodes ?? []) {
for (const o of issue.assignees?.nodes ?? []) {
const acc = await this.provider.getAccount(o)
if (acc !== undefined) {
assignees.push(acc)