Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Patch GitHub integration organization owner

Tuan Danga3093de55b28
diff --git a/backend/src/integrations/apps.ts b/backend/src/integrations/apps.ts
index f7eef62639..1bd138a370 100644
--- a/backend/src/integrations/apps.ts
+++ b/backend/src/integrations/apps.ts
@@ -270,10 +270,13 @@ const getAppsGithub = async ({ accessToken }: { accessToken: string }) => {
apps = repos
.filter((a: any) => a.permissions.admin === true)
- .map((a: any) => ({
- name: a.name,
- owner: a.owner.login,
- }));
+ .map((a: any) => {
+ return ({
+ appId: a.id,
+ name: a.name,
+ owner: a.owner.login,
+ });
+ });
} catch (err) {
Sentry.setUser(null);
Sentry.captureException(err);
diff --git a/backend/src/integrations/sync.ts b/backend/src/integrations/sync.ts
index 829b505316..53af1ac2cf 100644
--- a/backend/src/integrations/sync.ts
+++ b/backend/src/integrations/sync.ts
@@ -1060,7 +1060,7 @@ const syncSecretsGitHub = async ({
"GET /repos/{owner}/{repo}/actions/secrets/public-key",
{
owner: integration.owner,
- repo: integration.app,
+ repo: integration.app
}
)
).data;
diff --git a/frontend/src/pages/integrations/github/create.tsx b/frontend/src/pages/integrations/github/create.tsx
index 5fbd8f780f..c4368fe4f9 100644
--- a/frontend/src/pages/integrations/github/create.tsx
+++ b/frontend/src/pages/integrations/github/create.tsx
@@ -27,8 +27,7 @@ export default function GitHubCreateIntegrationPage() {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
- const [owner, setOwner] = useState<string | null>(null);
- const [targetApp, setTargetApp] = useState('');
+ const [targetAppId, setTargetAppId] = useState('');
const [isLoading, setIsLoading] = useState(false);
@@ -41,10 +40,9 @@ export default function GitHubCreateIntegrationPage() {
useEffect(() => {
if (integrationAuthApps) {
if (integrationAuthApps.length > 0) {
- setTargetApp(integrationAuthApps[0].name);
- setOwner(integrationAuthApps[0]?.owner ?? null);
+ setTargetAppId(integrationAuthApps[0].appId as string);
} else {
- setTargetApp('none');
+ setTargetAppId('none');
}
}
}, [integrationAuthApps]);
@@ -55,14 +53,18 @@ export default function GitHubCreateIntegrationPage() {
if (!integrationAuth?._id) return;
+ const targetApp = integrationAuthApps?.find((integrationAuthApp) => integrationAuthApp.appId === targetAppId);
+
+ if (!targetApp || !targetApp.owner) return;
+
await createIntegration({
integrationAuthId: integrationAuth?._id,
isActive: true,
- app: targetApp,
+ app: targetApp.name,
appId: null,
sourceEnvironment: selectedSourceEnvironment,
targetEnvironment: null,
- owner,
+ owner: targetApp.owner,
path: null,
region: null
});
@@ -76,7 +78,7 @@ export default function GitHubCreateIntegrationPage() {
}
}
- return (integrationAuth && workspace && selectedSourceEnvironment && integrationAuthApps && targetApp) ? (
+ return (integrationAuth && workspace && selectedSourceEnvironment && integrationAuthApps && targetAppId) ? (
<div className="h-full w-full flex justify-center items-center">
<Card className="max-w-md p-8 rounded-md">
<CardTitle className='text-center'>GitHub Integration</CardTitle>
@@ -101,14 +103,14 @@ export default function GitHubCreateIntegrationPage() {
className='mt-4'
>
<Select
- value={targetApp}
- onValueChange={(val) => setTargetApp(val)}
+ value={targetAppId}
+ onValueChange={(val) => setTargetAppId(val)}
className='w-full border border-mineshaft-500'
isDisabled={integrationAuthApps.length === 0}
>
{integrationAuthApps.length > 0 ? (
integrationAuthApps.map((integrationAuthApp) => (
- <SelectItem value={integrationAuthApp.name} key={`github-environment-${integrationAuthApp.name}`}>
+ <SelectItem value={integrationAuthApp.appId as string} key={`github-repo-${integrationAuthApp.appId}`}>
{integrationAuthApp.name}
</SelectItem>
))