Skip to content

Commit

Permalink
log cache hit
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jun 5, 2024
1 parent fd7433f commit c413f98
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions packages/core/src/github.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { assert } from "node:console"
import {
GITHUB_API_VERSION,
GITHUB_TOKEN,
} from "./constants"
import { GITHUB_API_VERSION, GITHUB_TOKEN } from "./constants"
import { createFetch } from "./fetch"
import { host } from "./host"
import { link, prettifyMarkdown } from "./markdown"
Expand Down Expand Up @@ -160,13 +157,16 @@ export async function githubCreateIssueComment(
const tag = `<!-- genaiscript ${commentTag} -->`
body = `${body}\n\n${tag}\n\n`
// try to find the existing comment
const resListComments = await fetch(`${url}?per_page=100&sort=updated`, {
headers: {
Accept: "application/vnd.github+json",
Authorization: `Bearer ${token}`,
"X-GitHub-Api-Version": GITHUB_API_VERSION,
},
})
const resListComments = await fetch(
`${url}?per_page=100&sort=updated`,
{
headers: {
Accept: "application/vnd.github+json",
Authorization: `Bearer ${token}`,
"X-GitHub-Api-Version": GITHUB_API_VERSION,
},
}
)
if (resListComments.status !== 200)
return { created: false, statusText: resListComments.statusText }
const comments = (await resListComments.json()) as {
Expand Down Expand Up @@ -238,6 +238,9 @@ async function githubCreatePullRequestReview(
c.body === body.body
)
) {
logVerbose(
`pull request ${commitSha} comment creation already exists, skipping`
)
return { created: false, statusText: "comment already exists" }
}
const fetch = await createFetch({ retryOn: [] })
Expand Down Expand Up @@ -305,7 +308,6 @@ export async function githubCreatePullRequestReviews(
line: number
body: string
}[]
console.log(comments)
// code annotations
for (const annotation of annotations) {
await githubCreatePullRequestReview(
Expand Down

0 comments on commit c413f98

Please sign in to comment.