mirror of
https://github.com/supabase/supabase.git
synced 2026-06-03 03:11:35 +08:00
chore(branching): GitHub integration 2.0 (#21008)
* start new github integration * query/mutation updates * progress * branch management * update codegen * progress * progress * Refactor GitHub integration URLs * Refactor GitHubIntegrationAuthorize component * Updates * Do not remove GitHub connection when creating new one * Deleting a GH connection when branching is enabled for the project, will also disable branching for that project * Add link to configure connection from org integration settings page * Slight refactor * Support updating CWD path * Change cwd_path to workdir and disallow empty values * Allow for triggering branches on supabase directory changes only * Pass missing supabaseChangesOnly value * Small style fix * Add Authorization GitHub step * Small change * Fix supabase integrations form in project settings * Revert URLa nd client ID * Fix UI issues --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com>
This commit is contained in:
30
apps/studio/data/integrations/github-authorization-query.ts
Normal file
30
apps/studio/data/integrations/github-authorization-query.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
|
||||
import { get } from 'data/fetchers'
|
||||
import { ResponseError } from 'types'
|
||||
import { integrationKeys } from './keys'
|
||||
|
||||
// FIXME(kamil): Do not retry, a single check is fine.
|
||||
export async function getGitHubAuthorization(signal?: AbortSignal) {
|
||||
const { data, error } = await get('/platform/integrations/github/authorization', {
|
||||
signal,
|
||||
})
|
||||
return error ? null : data
|
||||
}
|
||||
|
||||
export type GitHubAuthorizationData = Awaited<ReturnType<typeof getGitHubAuthorization>>
|
||||
export type ProjectGitHubRepositoryConnectionsData = Awaited<
|
||||
ReturnType<typeof getGitHubAuthorization>
|
||||
>
|
||||
export type GitHubAuthorizationError = ResponseError
|
||||
|
||||
export const useGitHubAuthorizationQuery = <TData = GitHubAuthorizationData>({
|
||||
enabled = true,
|
||||
...options
|
||||
}: UseQueryOptions<GitHubAuthorizationData, GitHubAuthorizationError, TData> = {}) => {
|
||||
return useQuery<GitHubAuthorizationData, GitHubAuthorizationError, TData>(
|
||||
integrationKeys.githubAuthorization(),
|
||||
({ signal }) => getGitHubAuthorization(signal),
|
||||
{ enabled, staleTime: 0, ...options }
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user