mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 14:28:20 +00:00
Patch GitHub integration organization owner
This commit is contained in:
@@ -270,10 +270,13 @@ const getAppsGithub = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
|
|
||||||
apps = repos
|
apps = repos
|
||||||
.filter((a: any) => a.permissions.admin === true)
|
.filter((a: any) => a.permissions.admin === true)
|
||||||
.map((a: any) => ({
|
.map((a: any) => {
|
||||||
name: a.name,
|
return ({
|
||||||
owner: a.owner.login,
|
appId: a.id,
|
||||||
}));
|
name: a.name,
|
||||||
|
owner: a.owner.login,
|
||||||
|
});
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Sentry.setUser(null);
|
Sentry.setUser(null);
|
||||||
Sentry.captureException(err);
|
Sentry.captureException(err);
|
||||||
|
|||||||
@@ -1060,7 +1060,7 @@ const syncSecretsGitHub = async ({
|
|||||||
"GET /repos/{owner}/{repo}/actions/secrets/public-key",
|
"GET /repos/{owner}/{repo}/actions/secrets/public-key",
|
||||||
{
|
{
|
||||||
owner: integration.owner,
|
owner: integration.owner,
|
||||||
repo: integration.app,
|
repo: integration.app
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
).data;
|
).data;
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ export default function GitHubCreateIntegrationPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
|
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
|
||||||
const [owner, setOwner] = useState<string | null>(null);
|
const [targetAppId, setTargetAppId] = useState('');
|
||||||
const [targetApp, setTargetApp] = useState('');
|
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
@@ -41,10 +40,9 @@ export default function GitHubCreateIntegrationPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (integrationAuthApps) {
|
if (integrationAuthApps) {
|
||||||
if (integrationAuthApps.length > 0) {
|
if (integrationAuthApps.length > 0) {
|
||||||
setTargetApp(integrationAuthApps[0].name);
|
setTargetAppId(integrationAuthApps[0].appId as string);
|
||||||
setOwner(integrationAuthApps[0]?.owner ?? null);
|
|
||||||
} else {
|
} else {
|
||||||
setTargetApp('none');
|
setTargetAppId('none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [integrationAuthApps]);
|
}, [integrationAuthApps]);
|
||||||
@@ -55,14 +53,18 @@ export default function GitHubCreateIntegrationPage() {
|
|||||||
|
|
||||||
if (!integrationAuth?._id) return;
|
if (!integrationAuth?._id) return;
|
||||||
|
|
||||||
|
const targetApp = integrationAuthApps?.find((integrationAuthApp) => integrationAuthApp.appId === targetAppId);
|
||||||
|
|
||||||
|
if (!targetApp || !targetApp.owner) return;
|
||||||
|
|
||||||
await createIntegration({
|
await createIntegration({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp.name,
|
||||||
appId: null,
|
appId: null,
|
||||||
sourceEnvironment: selectedSourceEnvironment,
|
sourceEnvironment: selectedSourceEnvironment,
|
||||||
targetEnvironment: null,
|
targetEnvironment: null,
|
||||||
owner,
|
owner: targetApp.owner,
|
||||||
path: null,
|
path: null,
|
||||||
region: 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">
|
<div className="h-full w-full flex justify-center items-center">
|
||||||
<Card className="max-w-md p-8 rounded-md">
|
<Card className="max-w-md p-8 rounded-md">
|
||||||
<CardTitle className='text-center'>GitHub Integration</CardTitle>
|
<CardTitle className='text-center'>GitHub Integration</CardTitle>
|
||||||
@@ -101,14 +103,14 @@ export default function GitHubCreateIntegrationPage() {
|
|||||||
className='mt-4'
|
className='mt-4'
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
value={targetApp}
|
value={targetAppId}
|
||||||
onValueChange={(val) => setTargetApp(val)}
|
onValueChange={(val) => setTargetAppId(val)}
|
||||||
className='w-full border border-mineshaft-500'
|
className='w-full border border-mineshaft-500'
|
||||||
isDisabled={integrationAuthApps.length === 0}
|
isDisabled={integrationAuthApps.length === 0}
|
||||||
>
|
>
|
||||||
{integrationAuthApps.length > 0 ? (
|
{integrationAuthApps.length > 0 ? (
|
||||||
integrationAuthApps.map((integrationAuthApp) => (
|
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}
|
{integrationAuthApp.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user