Skip to content

Commit 4aae535

Browse files
committed
fix: use @octokit/auth-app
1 parent 28227de commit 4aae535

File tree

3 files changed

+21
-134
lines changed

3 files changed

+21
-134
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"@iconify-json/tabler": "1.2.10",
1717
"@nuxthub/core": "^0.8.7",
1818
"@nuxtjs/html-validator": "1.8.2",
19+
"@octokit/auth-app": "^7.1.3",
20+
"@octokit/rest": "^21.0.2",
1921
"@octokit/webhooks-types": "^7.6.1",
2022
"@unocss/nuxt": "^0.65.1",
2123
"hex-rgb": "^5.0.0",
@@ -24,16 +26,15 @@
2426
"nuxt": "latest",
2527
"nuxt-time": "1.0.3",
2628
"nuxt-webhook-validators": "0.1.4",
27-
"octokit": "^4.0.2",
2829
"ohash": "^1.1.4",
2930
"openai": "^4.76.0",
3031
"rgb-to-hsl": "^0.0.3",
32+
"universal-github-app-jwt": "^2.2.0",
3133
"unocss": "^0.65.1",
3234
"unplugin-vue-router": "^0.10.9"
3335
},
3436
"devDependencies": {
3537
"@nuxt/eslint": "0.7.2",
36-
"@octokit/rest": "^21.0.2",
3738
"lint-staged": "15.2.10",
3839
"simple-git-hooks": "2.11.1",
3940
"typescript": "5.6.3",

pnpm-lock.yaml

+9-127
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/routes/github/webhook.post.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Installation, InstallationLite, WebhookEvent } from '@octokit/webhooks-types'
22
import type { H3Event } from 'h3'
3-
import { App } from 'octokit'
3+
import { createAppAuth } from '@octokit/auth-app'
4+
import { Octokit } from '@octokit/rest'
45

56
import { indexIssue, removeIssue, storagePrefixForRepo } from '../../utils/embeddings'
67

@@ -77,11 +78,14 @@ export type InstallationRepo = {
7778

7879
async function addRepos(event: H3Event, installation: Installation | InstallationLite, repos: InstallationRepo[]) {
7980
const config = useRuntimeConfig(event)
80-
const app = new App({
81-
appId: config.github.appId,
82-
privateKey: config.github.privateKey,
81+
const octokit = new Octokit({
82+
authStrategy: createAppAuth,
83+
auth: {
84+
appId: config.github.appId,
85+
privateKey: config.github.privateKey,
86+
installationId: installation.id,
87+
},
8388
})
84-
const octokit = await app.getInstallationOctokit(installation.id)
8589

8690
for (const repo of repos) {
8791
if (repo.private) {

0 commit comments

Comments
 (0)