diff --git a/app/backend/src/schema.ts b/app/backend/src/schema.ts index b3a6bede..7fb9f984 100644 --- a/app/backend/src/schema.ts +++ b/app/backend/src/schema.ts @@ -14,8 +14,8 @@ export const updateBaseImagesInputSchema = z.object({ export const secretsJsonSchema = z.record( z.string(), z.object({ - githubToken: z.string(), - githubApiUrl: z.string() + githubToken: z.string().min(1), + githubApiUrl: z.string().optional() }) ); export type FetchCurrentPageInput = z.infer; diff --git a/app/backend/test/getOctokit.test.ts b/app/backend/test/getOctokit.test.ts index 5324c1ff..325e26d9 100644 --- a/app/backend/test/getOctokit.test.ts +++ b/app/backend/test/getOctokit.test.ts @@ -26,6 +26,22 @@ describe('getOctokitOptions', () => { }); }); + it('does not throw if githubApiUrl is not provided', () => { + (readFileSync as jest.Mock).mockImplementation(() => ({ + toString: jest.fn(() => + JSON.stringify({ + 'github-owner/github-repo': { + githubToken: 'some-token' + } + }) + ) + })); + getOctokit('github-owner', 'github-repo'); + expect(Octokit).toHaveBeenCalledWith({ + auth: 'some-token' + }); + }); + it('throws error if token not found', () => { (readFileSync as jest.Mock).mockImplementation(() => ({ toString: jest.fn(() => JSON.stringify({}))