mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
coderabbit suggestions
This commit is contained in:
parent
1cd90071b3
commit
4af3b53062
8 changed files with 35 additions and 179 deletions
|
|
@ -63,8 +63,8 @@ The following environment variables allow you to configure your Sourcebot deploy
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
| :------- | :------ | :---------- |
|
| :------- | :------ | :---------- |
|
||||||
| `GITHUB_REVIEW_AGENT_APP_ID` | `-` | <p>The GitHub App ID used for review agent authentication.</p> |
|
| `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 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_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> |
|
| `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_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> |
|
| `REVIEW_AGENT_AUTO_REVIEW_ENABLED` | `false` | <p>Enables/disables automatic code reviews by the review agent.</p> |
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,13 @@
|
||||||
},
|
},
|
||||||
"deploymentHostname": {
|
"deploymentHostname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "url",
|
"format": "hostname",
|
||||||
"default": "github.com",
|
"default": "github.com",
|
||||||
"description": "The hostname of the GitHub App deployment.",
|
"description": "The hostname of the GitHub App deployment.",
|
||||||
"examples": [
|
"examples": [
|
||||||
"github.com",
|
"github.com",
|
||||||
"github.example.com"
|
"github.example.com"
|
||||||
],
|
]
|
||||||
"pattern": "^[^\\s/$.?#].[^\\s]*$"
|
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -58,37 +57,6 @@
|
||||||
"additionalProperties": false
|
"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": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,13 @@
|
||||||
},
|
},
|
||||||
"deploymentHostname": {
|
"deploymentHostname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "url",
|
"format": "hostname",
|
||||||
"default": "github.com",
|
"default": "github.com",
|
||||||
"description": "The hostname of the GitHub App deployment.",
|
"description": "The hostname of the GitHub App deployment.",
|
||||||
"examples": [
|
"examples": [
|
||||||
"github.com",
|
"github.com",
|
||||||
"github.example.com"
|
"github.example.com"
|
||||||
],
|
]
|
||||||
"pattern": "^[^\\s/$.?#].[^\\s]*$"
|
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -54,37 +53,6 @@
|
||||||
"additionalProperties": false
|
"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": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,15 @@ export class GithubAppManager {
|
||||||
logger.info(`Found ${installations.data.length} GitHub App installations for ${deploymentHostname}/${app.id}:`);
|
logger.info(`Found ${installations.data.length} GitHub App installations for ${deploymentHostname}/${app.id}:`);
|
||||||
|
|
||||||
for (const installationData of installations.data) {
|
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!;
|
logger.info(`\tInstallation ID: ${installationData.id}, Account: ${installationData.account.login}, Type: ${installationData.account.type}`);
|
||||||
const accountType = installationData.account?.type!.toLowerCase() as 'organization' | 'user';
|
|
||||||
|
const owner = installationData.account.login;
|
||||||
|
const accountType = installationData.account.type.toLowerCase() as 'organization' | 'user';
|
||||||
const installationOctokit = await octokitApp.getInstallationOctokit(installationData.id);
|
const installationOctokit = await octokitApp.getInstallationOctokit(installationData.id);
|
||||||
const auth = await installationOctokit.auth({ type: "installation" }) as { expires_at: string, token: string };
|
const auth = await installationOctokit.auth({ type: "installation" }) as { expires_at: string, token: string };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,13 @@ const schema = {
|
||||||
},
|
},
|
||||||
"deploymentHostname": {
|
"deploymentHostname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "url",
|
"format": "hostname",
|
||||||
"default": "github.com",
|
"default": "github.com",
|
||||||
"description": "The hostname of the GitHub App deployment.",
|
"description": "The hostname of the GitHub App deployment.",
|
||||||
"examples": [
|
"examples": [
|
||||||
"github.com",
|
"github.com",
|
||||||
"github.example.com"
|
"github.example.com"
|
||||||
],
|
]
|
||||||
"pattern": "^[^\\s/$.?#].[^\\s]*$"
|
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -57,37 +56,6 @@ const schema = {
|
||||||
"additionalProperties": false
|
"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": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,13 @@ const schema = {
|
||||||
},
|
},
|
||||||
"deploymentHostname": {
|
"deploymentHostname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "url",
|
"format": "hostname",
|
||||||
"default": "github.com",
|
"default": "github.com",
|
||||||
"description": "The hostname of the GitHub App deployment.",
|
"description": "The hostname of the GitHub App deployment.",
|
||||||
"examples": [
|
"examples": [
|
||||||
"github.com",
|
"github.com",
|
||||||
"github.example.com"
|
"github.example.com"
|
||||||
],
|
]
|
||||||
"pattern": "^[^\\s/$.?#].[^\\s]*$"
|
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -53,37 +52,6 @@ const schema = {
|
||||||
"additionalProperties": false
|
"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": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -29,22 +29,6 @@ export type GithubAppConfig = {
|
||||||
*/
|
*/
|
||||||
env: string;
|
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;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,13 @@
|
||||||
},
|
},
|
||||||
"deploymentHostname": {
|
"deploymentHostname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "url",
|
"format": "hostname",
|
||||||
"default": "github.com",
|
"default": "github.com",
|
||||||
"description": "The hostname of the GitHub App deployment.",
|
"description": "The hostname of the GitHub App deployment.",
|
||||||
"examples": [
|
"examples": [
|
||||||
"github.com",
|
"github.com",
|
||||||
"github.example.com"
|
"github.example.com"
|
||||||
],
|
]
|
||||||
"pattern": "^[^\\s/$.?#].[^\\s]*$"
|
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -25,10 +24,6 @@
|
||||||
"privateKey": {
|
"privateKey": {
|
||||||
"$ref": "./shared.json#/definitions/Token",
|
"$ref": "./shared.json#/definitions/Token",
|
||||||
"description": "The private key of the GitHub App."
|
"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": [
|
"required": [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue