Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

ref: Add GitHub configuration/revoke links for better UX (#22005)

Kamil Ogórek45421ed917e7
diff --git a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 44975703eda..3c249821c0c 100644
--- a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -20,6 +20,11 @@ import { useSidePanelsStateSnapshot } from 'state/side-panels'
import { IntegrationConnectionItem } from '../../Integrations/IntegrationConnection'
import SidePanelGitHubRepoLinker from './SidePanelGitHubRepoLinker'
import SidePanelVercelProjectLinker from './SidePanelVercelProjectLinker'
+import { useGitHubAuthorizationQuery } from 'data/integrations/github-authorization-query'
+import {
+ GITHUB_INTEGRATION_INSTALLATION_URL,
+ GITHUB_INTEGRATION_REVOKE_AUTHORIZATION_URL,
+} from 'lib/github'
const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' }) => {
return (
@@ -34,6 +39,8 @@ const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' }) => {
const IntegrationSettings = () => {
const org = useSelectedOrganization()
const hasAccessToBranching = useFlag<boolean>('branchManagement')
+ const { data: gitHubAuthorization, isLoading: isLoadingGitHubAuthorization } =
+ useGitHubAuthorizationQuery()
const { data: connections } = useGitHubConnectionsQuery({ organizationId: org?.id })
const { mutate: deleteGitHubConnection } = useGitHubConnectionDeleteMutation({
@@ -80,6 +87,10 @@ You will be able to connect a GitHub repository to a Supabase project.
The GitHub app will watch for changes in your repository such as file changes, branch changes as well as pull request activity.
`
+ const GitHubContentSectionBottom = gitHubAuthorization
+ ? `You are authorized with Supabase GitHub App. You can configure your GitHub App installations and repository access [here](${GITHUB_INTEGRATION_INSTALLATION_URL}). You can revoke your authorization [here](${GITHUB_INTEGRATION_REVOKE_AUTHORIZATION_URL}).`
+ : ''
+
const GitHubSection = () => (
<ScaffoldContainer>
<ScaffoldSection>
@@ -137,6 +148,9 @@ The GitHub app will watch for changes in your repository such as file changes, b
is required to add GitHub connections.
</p>
)}
+ {GitHubContentSectionBottom && (
+ <Markdown content={GitHubContentSectionBottom} className="text-foreground-lighter" />
+ )}
</ScaffoldSectionContent>
</ScaffoldSection>
</ScaffoldContainer>
diff --git a/apps/studio/lib/github.tsx b/apps/studio/lib/github.tsx
index d88f654fb75..7416e9681e5 100644
--- a/apps/studio/lib/github.tsx
+++ b/apps/studio/lib/github.tsx
@@ -1,9 +1,9 @@
-const GITHUB_INTEGRATION_INSTALLATION_URL =
+const GITHUB_INTEGRATION_APP_NAME =
process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod'
- ? `https://github.com/apps/supabase/installations/new`
+ ? `supabase`
: process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'
- ? `https://github.com/apps/supabase-staging/installations/new`
- : `https://github.com/apps/supabase-local-testing/installations/new`
+ ? `supabase-staging`
+ : `supabase-local-testing`
const GITHUB_INTEGRATION_CLIENT_ID =
process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod'
@@ -13,6 +13,8 @@ const GITHUB_INTEGRATION_CLIENT_ID =
: `Iv1.5022a3b44d150fbf`
const GITHUB_INTEGRATION_AUTHORIZATION_URL = `https://github.com/login/oauth/authorize?client_id=${GITHUB_INTEGRATION_CLIENT_ID}`
+export const GITHUB_INTEGRATION_INSTALLATION_URL = `https://github.com/apps/${GITHUB_INTEGRATION_APP_NAME}/installations/new`
+export const GITHUB_INTEGRATION_REVOKE_AUTHORIZATION_URL = `https://github.com/settings/connections/applications/${GITHUB_INTEGRATION_CLIENT_ID}`
export function openInstallGitHubIntegrationWindow(type: 'install' | 'authorize') {
const w = 600