mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
Merge branch 'main' into ghes-review-agent
This commit is contained in:
commit
b3c164c315
2 changed files with 25 additions and 6 deletions
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
- Fixed spurious infinite loads with explore panel, file tree, and file search command. [#617](https://github.com/sourcebot-dev/sourcebot/pull/617)
|
||||
- Wipe search context on init if entitlement no longer exists [#618](https://github.com/sourcebot-dev/sourcebot/pull/618)
|
||||
- Fixed Bitbucket repository exclusions not supporting glob patterns. [#620](https://github.com/sourcebot-dev/sourcebot/pull/620)
|
||||
- Fixed review agent so that it works with GHES instances [#611](https://github.com/sourcebot-dev/sourcebot/pull/611)
|
||||
|
||||
## [4.9.2] - 2025-11-13
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import type { ClientOptions, ClientPathsWithMethod } from "openapi-fetch";
|
|||
import { createLogger } from "@sourcebot/shared";
|
||||
import { measure, fetchWithRetry } from "./utils.js";
|
||||
import * as Sentry from "@sentry/node";
|
||||
import micromatch from "micromatch";
|
||||
import {
|
||||
SchemaRepository as CloudRepository,
|
||||
} from "@coderabbitai/bitbucket/cloud/openapi";
|
||||
|
|
@ -346,23 +347,31 @@ async function cloudGetRepos(client: BitbucketClient, repoList: string[]): Promi
|
|||
|
||||
function cloudShouldExcludeRepo(repo: BitbucketRepository, config: BitbucketConnectionConfig): boolean {
|
||||
const cloudRepo = repo as CloudRepository;
|
||||
let reason = '';
|
||||
const repoName = cloudRepo.full_name!;
|
||||
|
||||
const shouldExclude = (() => {
|
||||
if (config.exclude?.repos && config.exclude.repos.includes(cloudRepo.full_name!)) {
|
||||
if (config.exclude?.repos) {
|
||||
if (micromatch.isMatch(repoName, config.exclude.repos)) {
|
||||
reason = `\`exclude.repos\` contains ${repoName}`;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!!config.exclude?.archived) {
|
||||
logger.warn(`Exclude archived repos flag provided in config but Bitbucket Cloud does not support archived repos. Ignoring...`);
|
||||
}
|
||||
|
||||
if (!!config.exclude?.forks && cloudRepo.parent !== undefined) {
|
||||
reason = `\`exclude.forks\` is true`;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
||||
|
||||
if (shouldExclude) {
|
||||
logger.debug(`Excluding repo ${cloudRepo.full_name} because it matches the exclude pattern`);
|
||||
logger.debug(`Excluding repo ${repoName}. Reason: ${reason}`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -548,23 +557,32 @@ function serverShouldExcludeRepo(repo: BitbucketRepository, config: BitbucketCon
|
|||
|
||||
const projectName = serverRepo.project!.key;
|
||||
const repoSlug = serverRepo.slug!;
|
||||
const repoName = `${projectName}/${repoSlug}`;
|
||||
let reason = '';
|
||||
|
||||
const shouldExclude = (() => {
|
||||
if (config.exclude?.repos && config.exclude.repos.includes(`${projectName}/${repoSlug}`)) {
|
||||
if (config.exclude?.repos) {
|
||||
if (micromatch.isMatch(repoName, config.exclude.repos)) {
|
||||
reason = `\`exclude.repos\` contains ${repoName}`;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!!config.exclude?.archived && serverRepo.archived) {
|
||||
reason = `\`exclude.archived\` is true`;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!!config.exclude?.forks && serverRepo.origin !== undefined) {
|
||||
reason = `\`exclude.forks\` is true`;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
||||
|
||||
if (shouldExclude) {
|
||||
logger.debug(`Excluding repo ${projectName}/${repoSlug} because it matches the exclude pattern`);
|
||||
logger.debug(`Excluding repo ${repoName}. Reason: ${reason}`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue