mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 15:03:16 +00:00
fix: Replace newlines with backslash n for github private key (#333)
This commit is contained in:
parent
71a31a3649
commit
bc1549032f
1 changed files with 6 additions and 1 deletions
|
|
@ -1,12 +1,17 @@
|
|||
import { App } from "@octokit/app";
|
||||
import { Octokit } from "@octokit/core";
|
||||
|
||||
const replaceNewlinesWithBackslashN = (str: string) =>
|
||||
str.replace(/\n/g, "\\n");
|
||||
|
||||
export class GitHubApp {
|
||||
app: App;
|
||||
|
||||
constructor() {
|
||||
const appId = process.env.GITHUB_APP_ID;
|
||||
const privateKey = process.env.GITHUB_APP_PRIVATE_KEY;
|
||||
const privateKey = process.env.GITHUB_APP_PRIVATE_KEY
|
||||
? replaceNewlinesWithBackslashN(process.env.GITHUB_APP_PRIVATE_KEY)
|
||||
: undefined;
|
||||
const webhookSecret = process.env.GITHUB_WEBHOOK_SECRET;
|
||||
if (!appId || !privateKey || !webhookSecret) {
|
||||
throw new Error(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue