From 2e568dfe8257e0f142adff129e5581ebba04cf49 Mon Sep 17 00:00:00 2001 From: jinser Date: Tue, 21 Feb 2023 15:28:27 +0800 Subject: [PATCH] github app name env --- github-extension/lib/github.ts | 1 + github-extension/pages/api/[flows_user]/[flow_id]/listen.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/github-extension/lib/github.ts b/github-extension/lib/github.ts index ff86a7d..ebe2ff8 100644 --- a/github-extension/lib/github.ts +++ b/github-extension/lib/github.ts @@ -1,6 +1,7 @@ import { env, exit } from "process"; export const APP_ID = env.GITHUB_APP_ID || exit(); +export const APP_NAME = env.GITHUB_APP_NAME || exit(); export const CLIENT_ID = env.GITHUB_CLIENT_ID || exit(); export const CLIENT_SECRET = env.GITHUB_CLIENT_SECRET || exit(); export const PRIVATE_KEY = env.GITHUB_PRIVATE_KEY || exit(); diff --git a/github-extension/pages/api/[flows_user]/[flow_id]/listen.ts b/github-extension/pages/api/[flows_user]/[flow_id]/listen.ts index d57087a..098a339 100644 --- a/github-extension/pages/api/[flows_user]/[flow_id]/listen.ts +++ b/github-extension/pages/api/[flows_user]/[flow_id]/listen.ts @@ -2,6 +2,7 @@ import type { NextApiRequest, NextApiResponse } from "next" import { redis } from "@/lib/upstash"; import issueCommentEvent from "resources/issue_comment_event.json"; +import { APP_NAME } from "@/lib/github"; const fn = async (req: NextApiRequest, res: NextApiResponse) => { const { flows_user, flow_id, owner, repo, events } = req.query; @@ -37,7 +38,7 @@ const fn = async (req: NextApiRequest, res: NextApiResponse) => { if (!token) { return res.status(400).send( "User has not been authorized, you need to " - + `[install the App](https://github.com/apps/flows-network-js/installations/new) to GitHub \`${owner}\` first` + + `[install the App](https://github.com/apps/${APP_NAME}/installations/new) to GitHub \`${owner}\` first` ); }