File tree Expand file tree Collapse file tree 11 files changed +346
-210
lines changed
Expand file tree Collapse file tree 11 files changed +346
-210
lines changed Original file line number Diff line number Diff line change 33{
44 "$schema" : " http://json-schema.org/draft-07/schema#" ,
55 "title" : " AppConfig" ,
6- "oneOf" : [
7- {
8- "$schema" : " http://json-schema.org/draft-07/schema#" ,
6+ "definitions" : {
7+ "GitHubAppConfig" : {
98 "type" : " object" ,
10- "title" : " GithubAppConfig" ,
119 "properties" : {
1210 "type" : {
1311 "const" : " githubApp" ,
6159 },
6260 "required" : [
6361 " type" ,
64- " id"
62+ " id" ,
63+ " privateKey"
6564 ],
66- "oneOf" : [
67- {
68- "required" : [
69- " privateKey"
65+ "additionalProperties" : false
66+ }
67+ },
68+ "oneOf" : [
69+ {
70+ "type" : " object" ,
71+ "properties" : {
72+ "type" : {
73+ "const" : " githubApp" ,
74+ "description" : " GitHub App Configuration"
75+ },
76+ "deploymentHostname" : {
77+ "type" : " string" ,
78+ "format" : " hostname" ,
79+ "default" : " github.com" ,
80+ "description" : " The hostname of the GitHub App deployment." ,
81+ "examples" : [
82+ " github.com" ,
83+ " github.example.com"
7084 ]
7185 },
72- {
73- "required" : [
74- " privateKeyPath"
86+ "id" : {
87+ "type" : " string" ,
88+ "description" : " The ID of the GitHub App."
89+ },
90+ "privateKey" : {
91+ "description" : " The private key of the GitHub App." ,
92+ "anyOf" : [
93+ {
94+ "type" : " object" ,
95+ "properties" : {
96+ "secret" : {
97+ "type" : " string" ,
98+ "description" : " The name of the secret that contains the token."
99+ }
100+ },
101+ "required" : [
102+ " secret"
103+ ],
104+ "additionalProperties" : false
105+ },
106+ {
107+ "type" : " object" ,
108+ "properties" : {
109+ "env" : {
110+ "type" : " string" ,
111+ "description" : " The name of the environment variable that contains the token. Only supported in declarative connection configs."
112+ }
113+ },
114+ "required" : [
115+ " env"
116+ ],
117+ "additionalProperties" : false
118+ }
75119 ]
76120 }
121+ },
122+ "required" : [
123+ " type" ,
124+ " id" ,
125+ " privateKey"
77126 ],
78127 "additionalProperties" : false
79128 }
Original file line number Diff line number Diff line change 42804280 "items" : {
42814281 "$schema" : " http://json-schema.org/draft-07/schema#" ,
42824282 "title" : " AppConfig" ,
4283- "oneOf" : [
4284- {
4285- "$schema" : " http://json-schema.org/draft-07/schema#" ,
4283+ "definitions" : {
4284+ "GitHubAppConfig" : {
42864285 "type" : " object" ,
4287- "title" : " GithubAppConfig" ,
42884286 "properties" : {
42894287 "type" : {
42904288 "const" : " githubApp" ,
43384336 },
43394337 "required" : [
43404338 " type" ,
4341- " id"
4339+ " id" ,
4340+ " privateKey"
43424341 ],
4343- "oneOf" : [
4344- {
4345- "required" : [
4346- " privateKey"
4347- ]
4342+ "additionalProperties" : false
4343+ }
4344+ },
4345+ "oneOf" : [
4346+ {
4347+ "type" : " object" ,
4348+ "properties" : {
4349+ "type" : {
4350+ "const" : " githubApp" ,
4351+ "description" : " GitHub App Configuration"
43484352 },
4349- {
4350- "required" : [
4351- " privateKeyPath"
4353+ "deploymentHostname" : {
4354+ "type" : " string" ,
4355+ "format" : " hostname" ,
4356+ "default" : " github.com" ,
4357+ "description" : " The hostname of the GitHub App deployment." ,
4358+ "examples" : [
4359+ " github.com" ,
4360+ " github.example.com"
43524361 ]
4362+ },
4363+ "id" : {
4364+ "type" : " string" ,
4365+ "description" : " The ID of the GitHub App."
4366+ },
4367+ "privateKey" : {
4368+ "anyOf" : [
4369+ {
4370+ "type" : " object" ,
4371+ "properties" : {
4372+ "secret" : {
4373+ "type" : " string" ,
4374+ "description" : " The name of the secret that contains the token."
4375+ }
4376+ },
4377+ "required" : [
4378+ " secret"
4379+ ],
4380+ "additionalProperties" : false
4381+ },
4382+ {
4383+ "type" : " object" ,
4384+ "properties" : {
4385+ "env" : {
4386+ "type" : " string" ,
4387+ "description" : " The name of the environment variable that contains the token. Only supported in declarative connection configs."
4388+ }
4389+ },
4390+ "required" : [
4391+ " env"
4392+ ],
4393+ "additionalProperties" : false
4394+ }
4395+ ],
4396+ "description" : " The private key of the GitHub App."
43534397 }
4398+ },
4399+ "required" : [
4400+ " type" ,
4401+ " id" ,
4402+ " privateKey"
43544403 ],
43554404 "additionalProperties" : false
43564405 }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { createLogger } from "@sourcebot/logger";
55import { getTokenFromConfig } from "../utils.js" ;
66import { PrismaClient } from "@sourcebot/db" ;
77import { App } from "@octokit/app" ;
8+ import { GitHubAppConfig } from "@sourcebot/schemas/v3/index.type" ;
89
910const logger = createLogger ( 'githubAppManager' ) ;
1011const GITHUB_DEFAULT_DEPLOYMENT_HOSTNAME = 'github.com' ;
Original file line number Diff line number Diff line change 22const schema = {
33 "$schema" : "http://json-schema.org/draft-07/schema#" ,
44 "title" : "AppConfig" ,
5- "oneOf" : [
6- {
7- "$schema" : "http://json-schema.org/draft-07/schema#" ,
5+ "definitions" : {
6+ "GitHubAppConfig" : {
87 "type" : "object" ,
9- "title" : "GithubAppConfig" ,
108 "properties" : {
119 "type" : {
1210 "const" : "githubApp" ,
@@ -60,19 +58,70 @@ const schema = {
6058 } ,
6159 "required" : [
6260 "type" ,
63- "id"
61+ "id" ,
62+ "privateKey"
6463 ] ,
65- "oneOf" : [
66- {
67- "required" : [
68- "privateKey"
64+ "additionalProperties" : false
65+ }
66+ } ,
67+ "oneOf" : [
68+ {
69+ "type" : "object" ,
70+ "properties" : {
71+ "type" : {
72+ "const" : "githubApp" ,
73+ "description" : "GitHub App Configuration"
74+ } ,
75+ "deploymentHostname" : {
76+ "type" : "string" ,
77+ "format" : "hostname" ,
78+ "default" : "github.com" ,
79+ "description" : "The hostname of the GitHub App deployment." ,
80+ "examples" : [
81+ "github.com" ,
82+ "github.example.com"
6983 ]
7084 } ,
71- {
72- "required" : [
73- "privateKeyPath"
85+ "id" : {
86+ "type" : "string" ,
87+ "description" : "The ID of the GitHub App."
88+ } ,
89+ "privateKey" : {
90+ "description" : "The private key of the GitHub App." ,
91+ "anyOf" : [
92+ {
93+ "type" : "object" ,
94+ "properties" : {
95+ "secret" : {
96+ "type" : "string" ,
97+ "description" : "The name of the secret that contains the token."
98+ }
99+ } ,
100+ "required" : [
101+ "secret"
102+ ] ,
103+ "additionalProperties" : false
104+ } ,
105+ {
106+ "type" : "object" ,
107+ "properties" : {
108+ "env" : {
109+ "type" : "string" ,
110+ "description" : "The name of the environment variable that contains the token. Only supported in declarative connection configs."
111+ }
112+ } ,
113+ "required" : [
114+ "env"
115+ ] ,
116+ "additionalProperties" : false
117+ }
74118 ]
75119 }
120+ } ,
121+ "required" : [
122+ "type" ,
123+ "id" ,
124+ "privateKey"
76125 ] ,
77126 "additionalProperties" : false
78127 }
Original file line number Diff line number Diff line change 11// THIS IS A AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY!
22
3- export type AppConfig = GithubAppConfig ;
4- export type GithubAppConfig = {
5- [ k : string ] : unknown ;
6- } ;
3+ export type AppConfig = GitHubAppConfig ;
4+
5+ export interface GitHubAppConfig {
6+ /**
7+ * GitHub App Configuration
8+ */
9+ type : "githubApp" ;
10+ /**
11+ * The hostname of the GitHub App deployment.
12+ */
13+ deploymentHostname ?: string ;
14+ /**
15+ * The ID of the GitHub App.
16+ */
17+ id : string ;
18+ /**
19+ * The private key of the GitHub App.
20+ */
21+ privateKey :
22+ | {
23+ /**
24+ * The name of the secret that contains the token.
25+ */
26+ secret : string ;
27+ }
28+ | {
29+ /**
30+ * The name of the environment variable that contains the token. Only supported in declarative connection configs.
31+ */
32+ env : string ;
33+ } ;
34+ }
You can’t perform that action at this time.
0 commit comments