Skip to content

Commit f8e1cce

Browse files
remove @octokit/auth-app
1 parent 00407c0 commit f8e1cce

File tree

4 files changed

+6
-93
lines changed

4 files changed

+6
-93
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@netlify/vite-plugin-tanstack-start": "^1.0.2",
3636
"@number-flow/react": "^0.4.1",
3737
"@observablehq/plot": "^0.6.17",
38-
"@octokit/auth-app": "^8.2.0",
3938
"@octokit/graphql": "^7.0.2",
4039
"@octokit/rest": "^22.0.1",
4140
"@octokit/webhooks": "^14.2.0",

pnpm-lock.yaml

Lines changed: 0 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/routes/api/github/webhook.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
import { createFileRoute } from '@tanstack/react-router'
22
import { Webhooks } from '@octokit/webhooks'
33
import { Octokit } from '@octokit/rest'
4-
import { createAppAuth } from '@octokit/auth-app'
4+
import { env } from '~/utils/env'
55

66
const webhooks = new Webhooks({
7-
secret: process.env.GITHUB_WEBHOOK_SECRET ?? 'test',
7+
secret: env.GITHUB_WEBHOOK_SECRET,
88
})
99

10-
function getOctokit(installationId: number) {
10+
function getOctokit() {
1111
return new Octokit({
12-
authStrategy: createAppAuth,
13-
auth: {
14-
appId: process.env.GITHUB_APP_ID!,
15-
privateKey: process.env.GITHUB_PRIVATE_KEY!,
16-
installationId,
17-
},
12+
auth: env.GITHUB_AUTH_TOKEN
1813
})
1914
}
2015

2116
// Register event handlers
2217
webhooks.on('pull_request.opened', async ({ payload }) => {
2318
console.log('PR opened:', payload.pull_request.title)
2419

25-
const octokit = getOctokit(payload.installation!.id)
20+
const octokit = getOctokit()
2621

2722
await octokit.issues.createComment({
2823
owner: payload.repository.owner.login,

src/utils/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as v from 'valibot'
33
// Define server-only schema
44
const serverEnvSchema = v.object({
55
GITHUB_AUTH_TOKEN: v.optional(v.string(), 'USE_A_REAL_KEY_IN_PRODUCTION'),
6-
GITHUB_WEBHOOK_SECRET: v.optional(v.string()),
6+
GITHUB_WEBHOOK_SECRET: v.optional(v.string(), 'USE_A_REAL_KEY_IN_PRODUCTION'),
77
GITHUB_OAUTH_CLIENT_ID: v.optional(v.string()),
88
GITHUB_OAUTH_CLIENT_SECRET: v.optional(v.string()),
99
GOOGLE_OAUTH_CLIENT_ID: v.optional(v.string()),

0 commit comments

Comments
 (0)