import { GithubConnectionConfig } from "@sourcebot/schemas/v3/github.type" import { GitlabConnectionConfig } from "@sourcebot/schemas/v3/gitlab.type"; import { BitbucketConnectionConfig } from "@sourcebot/schemas/v3/bitbucket.type"; import { QuickAction } from "../components/configEditor"; import { GiteaConnectionConfig } from "@sourcebot/schemas/v3/gitea.type"; import { GerritConnectionConfig } from "@sourcebot/schemas/v3/gerrit.type"; import { CodeSnippet } from "@/app/components/codeSnippet"; export const githubQuickActions: QuickAction[] = [ { fn: (previous: GithubConnectionConfig) => ({ ...previous, repos: [ ...(previous.repos ?? []), "/" ] }), name: "Add a single repo", selectionText: "/", description: (
Add a individual repository to sync with. Ensure the repository is visible to the provided token (if any). Examples:
{[ "sourcebot/sourcebot", "vercel/next.js", "torvalds/linux" ].map((repo) => ( {repo} ))}
) }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, orgs: [ ...(previous.orgs ?? []), "" ] }), name: "Add an organization", selectionText: "", description: (
Add an organization to sync with. All repositories in the organization visible to the provided token (if any) will be synced. Examples:
{[ "commaai", "sourcebot", "vercel" ].map((org) => ( {org} ))}
) }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, users: [ ...(previous.users ?? []), "" ] }), name: "Add a user", selectionText: "", description: (
Add a user to sync with. All repositories that the user owns visible to the provided token (if any) will be synced. Examples:
{[ "jane-doe", "torvalds", "octocat" ].map((org) => ( {org} ))}
) }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, url: previous.url ?? "https://github.example.com", }), name: "Set url to GitHub instance", selectionText: "https://github.example.com", description: Set a custom GitHub host. Defaults to https://github.com. }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, repos: [ ...(previous.exclude?.repos ?? []), "" ] } }), name: "Exclude by repo name", selectionText: "", description: (
Exclude repositories from syncing by name. Glob patterns are supported. Examples:
{[ "my-org/docs*", "my-org/test*" ].map((repo) => ( {repo} ))}
) }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, topics: [ ...(previous.exclude?.topics ?? []), "" ] } }), name: "Exclude by topic", selectionText: "", description: (
Exclude topics from syncing. Only repos that do not match any of the provided topics will be synced. Glob patterns are supported. Examples:
{[ "docs", "ci" ].map((repo) => ( {repo} ))}
) }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, topics: [ ...(previous.topics ?? []), "" ] }), name: "Include by topic", selectionText: "", description: (
Include repositories by topic. Only repos that match at least one of the provided topics will be synced. Glob patterns are supported. Examples:
{[ "docs", "ci" ].map((repo) => ( {repo} ))}
) }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, archived: true, } }), name: "Exclude archived repos", description: Exclude archived repositories from syncing. }, { fn: (previous: GithubConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, forks: true, } }), name: "Exclude forked repos", description: Exclude forked repositories from syncing. } ]; export const gitlabQuickActions: QuickAction[] = [ { fn: (previous: GitlabConnectionConfig) => ({ ...previous, projects: [ ...previous.projects ?? [], "" ] }), name: "Add a project", selectionText: "", description: (
Add a individual project to sync with. Ensure the project is visible to the provided token (if any). Examples:
{[ "gitlab-org/gitlab", "corp/team-project", ].map((repo) => ( {repo} ))}
) }, { fn: (previous: GitlabConnectionConfig) => ({ ...previous, users: [ ...previous.users ?? [], "" ] }), name: "Add a user", selectionText: "", description: (
Add a user to sync with. All projects that the user owns visible to the provided token (if any) will be synced. Examples:
{[ "jane-doe", "torvalds" ].map((org) => ( {org} ))}
) }, { fn: (previous: GitlabConnectionConfig) => ({ ...previous, groups: [ ...previous.groups ?? [], "" ] }), name: "Add a group", selectionText: "", description: (
Add a group to sync with. All projects in the group (and recursive subgroups) visible to the provided token (if any) will be synced. Examples:
{[ "my-group", "path/to/subgroup" ].map((org) => ( {org} ))}
) }, { fn: (previous: GitlabConnectionConfig) => ({ ...previous, url: previous.url ?? "https://gitlab.example.com", }), name: "Set url to GitLab instance", selectionText: "https://gitlab.example.com", description: Set a custom GitLab host. Defaults to https://gitlab.com. }, { fn: (previous: GitlabConnectionConfig) => ({ ...previous, all: true, }), name: "Sync all projects", description: Sync all projects visible to the provided token (if any). Only available when using a self-hosted GitLab instance. }, { fn: (previous: GitlabConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, projects: [ ...(previous.exclude?.projects ?? []), "" ] } }), name: "Exclude a project", selectionText: "", description: (
List of projects to exclude from syncing. Glob patterns are supported. Examples:
{[ "docs/**", "**/tests/**", ].map((repo) => ( {repo} ))}
) } ] export const giteaQuickActions: QuickAction[] = [ { fn: (previous: GiteaConnectionConfig) => ({ ...previous, orgs: [ ...(previous.orgs ?? []), "" ] }), name: "Add an organization", selectionText: "", }, { fn: (previous: GiteaConnectionConfig) => ({ ...previous, repos: [ ...(previous.repos ?? []), "/" ] }), name: "Add a repo", selectionText: "/", }, { fn: (previous: GiteaConnectionConfig) => ({ ...previous, url: previous.url ?? "https://gitea.example.com", }), name: "Set url to Gitea instance", selectionText: "https://gitea.example.com", } ] export const gerritQuickActions: QuickAction[] = [ { fn: (previous: GerritConnectionConfig) => ({ ...previous, projects: [ ...(previous.projects ?? []), "" ] }), name: "Add a project", }, { fn: (previous: GerritConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, projects: [ ...(previous.exclude?.projects ?? []), "" ] } }), name: "Exclude a project", } ] export const bitbucketCloudQuickActions: QuickAction[] = [ { // add user fn: (previous: BitbucketConnectionConfig) => ({ ...previous, user: previous.user ?? "username" }), name: "Add username", selectionText: "username", description: (
Username to use for authentication. This is only required if you're using an App Password (stored in token) for authentication.
) }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, workspaces: [ ...(previous.workspaces ?? []), "myWorkspace" ] }), name: "Add a workspace", selectionText: "myWorkspace", description: (
Add a workspace to sync with. Ensure the workspace is visible to the provided token (if any).
) }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, repos: [ ...(previous.repos ?? []), "myWorkspace/myRepo" ] }), name: "Add a repo", selectionText: "myWorkspace/myRepo", description: (
Add an individual repository to sync with. Ensure the repository is visible to the provided token (if any).
) }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, projects: [ ...(previous.projects ?? []), "myProject" ] }), name: "Add a project", selectionText: "myProject", description: (
Add a project to sync with. Ensure the project is visible to the provided token (if any).
) }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, repos: [...(previous.exclude?.repos ?? []), "myWorkspace/myExcludedRepo"] } }), name: "Exclude a repo", selectionText: "myWorkspace/myExcludedRepo", description: (
Exclude a repository from syncing. Glob patterns are supported.
) }, // exclude forked { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, forks: true } }), name: "Exclude forked repos", description: Exclude forked repositories from syncing. } ] export const bitbucketDataCenterQuickActions: QuickAction[] = [ { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, url: previous.url ?? "https://bitbucket.example.com", }), name: "Set url to Bitbucket DC instance", selectionText: "https://bitbucket.example.com", }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, repos: [ ...(previous.repos ?? []), "myProject/myRepo" ] }), name: "Add a repo", selectionText: "myProject/myRepo", description: (
Add a individual repository to sync with. Ensure the repository is visible to the provided token (if any). Examples:
{[ "PROJ/repo-name", "MYPROJ/api" ].map((repo) => ( {repo} ))}
) }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, projects: [ ...(previous.projects ?? []), "myProject" ] }), name: "Add a project", selectionText: "myProject", description: (
Add a project to sync with. Ensure the project is visible to the provided token (if any).
) }, { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, repos: [...(previous.exclude?.repos ?? []), "myProject/myExcludedRepo"] } }), name: "Exclude a repo", selectionText: "myProject/myExcludedRepo", description: (
Exclude a repository from syncing. Glob patterns are supported. Examples:
{[ "myProject/myExcludedRepo", "myProject2/*" ].map((repo) => ( {repo} ))}
) }, // exclude archived { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, archived: true } }), name: "Exclude archived repos", }, // exclude forked { fn: (previous: BitbucketConnectionConfig) => ({ ...previous, exclude: { ...previous.exclude, forks: true } }), name: "Exclude forked repos", } ]