mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
refactor/bugfix: simplify hasOpenHandsSuffix with provider lookup for gitlab/azure (#11877)
Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
This commit is contained in:
parent
eaea8b3ce1
commit
14695a8f0e
@ -606,10 +606,15 @@ export const shouldIncludeRepository = (
|
||||
* @returns The query string for searching OpenHands repositories
|
||||
*/
|
||||
export const getOpenHandsQuery = (provider: Provider | null): string => {
|
||||
if (provider === "gitlab") {
|
||||
return "openhands-config";
|
||||
}
|
||||
return ".openhands";
|
||||
const providerRepositorySuffix: Record<string, string> = {
|
||||
gitlab: "openhands-config",
|
||||
azure_devops: "openhands-config",
|
||||
default: ".openhands",
|
||||
} as const;
|
||||
|
||||
return provider && provider in providerRepositorySuffix
|
||||
? providerRepositorySuffix[provider]
|
||||
: providerRepositorySuffix.default;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -621,12 +626,7 @@ export const getOpenHandsQuery = (provider: Provider | null): string => {
|
||||
export const hasOpenHandsSuffix = (
|
||||
repo: GitRepository,
|
||||
provider: Provider | null,
|
||||
): boolean => {
|
||||
if (provider === "gitlab") {
|
||||
return repo.full_name.endsWith("/openhands-config");
|
||||
}
|
||||
return repo.full_name.endsWith("/.openhands");
|
||||
};
|
||||
): boolean => repo.full_name.endsWith(`/${getOpenHandsQuery(provider)}`);
|
||||
|
||||
/**
|
||||
* Build headers for V1 API requests that require session authentication
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user