coderabbit suggestions

This commit is contained in:
msukkari 2025-10-21 19:06:54 -07:00
parent 1cd90071b3
commit 4af3b53062
8 changed files with 35 additions and 179 deletions

View file

@ -63,8 +63,8 @@ The following environment variables allow you to configure your Sourcebot deploy
| Variable | Default | Description |
| :------- | :------ | :---------- |
| `GITHUB_REVIEW_AGENT_APP_ID` | `-` | <p>The GitHub App ID used for review agent authentication.</p> |
| `GITHUB_REVIEW_AGENT_APP_WEBHOOK_SECRET` | `-` | <p>The container relative path to the private key file for the GitHub App used by the review agent.</p> |
| `GITHUB_REVIEW_AGENT_APP_PRIVATE_KEY_PATH` | `-` | <p>The webhook secret for the GitHub App used by the review agent.</p> |
| `GITHUB_REVIEW_AGENT_APP_PRIVATE_KEY_PATH` | `-` | <p>The container relative path to the private key file for the GitHub App used by the review agent.</p> |
| `GITHUB_REVIEW_AGENT_APP_WEBHOOK_SECRET` | `-` | <p>The webhook secret for the GitHub App used by the review agent.</p> |
| `OPENAI_API_KEY` | `-` | <p>The OpenAI API key used by the review agent.</p> |
| `REVIEW_AGENT_API_KEY` | `-` | <p>The Sourcebot API key used by the review agent.</p> |
| `REVIEW_AGENT_AUTO_REVIEW_ENABLED` | `false` | <p>Enables/disables automatic code reviews by the review agent.</p> |

View file

@ -15,14 +15,13 @@
},
"deploymentHostname": {
"type": "string",
"format": "url",
"format": "hostname",
"default": "github.com",
"description": "The hostname of the GitHub App deployment.",
"examples": [
"github.com",
"github.example.com"
],
"pattern": "^[^\\s/$.?#].[^\\s]*$"
]
},
"id": {
"type": "string",
@ -58,37 +57,6 @@
"additionalProperties": false
}
]
},
"privateKeyPath": {
"description": "The path to the private key of the GitHub App.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
}
},
"required": [

View file

@ -11,14 +11,13 @@
},
"deploymentHostname": {
"type": "string",
"format": "url",
"format": "hostname",
"default": "github.com",
"description": "The hostname of the GitHub App deployment.",
"examples": [
"github.com",
"github.example.com"
],
"pattern": "^[^\\s/$.?#].[^\\s]*$"
]
},
"id": {
"type": "string",
@ -54,37 +53,6 @@
"additionalProperties": false
}
]
},
"privateKeyPath": {
"description": "The path to the private key of the GitHub App.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
}
},
"required": [

View file

@ -71,10 +71,15 @@ export class GithubAppManager {
logger.info(`Found ${installations.data.length} GitHub App installations for ${deploymentHostname}/${app.id}:`);
for (const installationData of installations.data) {
logger.info(`\tInstallation ID: ${installationData.id}, Account: ${installationData.account?.login}, Type: ${installationData.account?.type}`);
if (!installationData.account || !installationData.account.login || !installationData.account.type) {
logger.warn(`Skipping installation ${installationData.id}: missing account data (${installationData.account})`);
continue;
}
const owner = installationData.account?.login!;
const accountType = installationData.account?.type!.toLowerCase() as 'organization' | 'user';
logger.info(`\tInstallation ID: ${installationData.id}, Account: ${installationData.account.login}, Type: ${installationData.account.type}`);
const owner = installationData.account.login;
const accountType = installationData.account.type.toLowerCase() as 'organization' | 'user';
const installationOctokit = await octokitApp.getInstallationOctokit(installationData.id);
const auth = await installationOctokit.auth({ type: "installation" }) as { expires_at: string, token: string };

View file

@ -14,14 +14,13 @@ const schema = {
},
"deploymentHostname": {
"type": "string",
"format": "url",
"format": "hostname",
"default": "github.com",
"description": "The hostname of the GitHub App deployment.",
"examples": [
"github.com",
"github.example.com"
],
"pattern": "^[^\\s/$.?#].[^\\s]*$"
]
},
"id": {
"type": "string",
@ -57,37 +56,6 @@ const schema = {
"additionalProperties": false
}
]
},
"privateKeyPath": {
"description": "The path to the private key of the GitHub App.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
}
},
"required": [

View file

@ -10,14 +10,13 @@ const schema = {
},
"deploymentHostname": {
"type": "string",
"format": "url",
"format": "hostname",
"default": "github.com",
"description": "The hostname of the GitHub App deployment.",
"examples": [
"github.com",
"github.example.com"
],
"pattern": "^[^\\s/$.?#].[^\\s]*$"
]
},
"id": {
"type": "string",
@ -53,37 +52,6 @@ const schema = {
"additionalProperties": false
}
]
},
"privateKeyPath": {
"description": "The path to the private key of the GitHub App.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
}
},
"required": [

View file

@ -29,22 +29,6 @@ export type GithubAppConfig = {
*/
env: string;
};
/**
* The path to the private key of the GitHub App.
*/
privateKeyPath?:
| {
/**
* The name of the secret that contains the token.
*/
secret: string;
}
| {
/**
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
*/
env: string;
};
} & {
[k: string]: unknown;
};

View file

@ -9,14 +9,13 @@
},
"deploymentHostname": {
"type": "string",
"format": "url",
"format": "hostname",
"default": "github.com",
"description": "The hostname of the GitHub App deployment.",
"examples": [
"github.com",
"github.example.com"
],
"pattern": "^[^\\s/$.?#].[^\\s]*$"
]
},
"id": {
"type": "string",
@ -25,10 +24,6 @@
"privateKey": {
"$ref": "./shared.json#/definitions/Token",
"description": "The private key of the GitHub App."
},
"privateKeyPath": {
"$ref": "./shared.json#/definitions/Token",
"description": "The path to the private key of the GitHub App."
}
},
"required": [