mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Patch GitHub integration for organization repos by including correct owner
This commit is contained in:
@@ -26,7 +26,8 @@ interface TIntegration {
|
||||
|
||||
interface IntegrationApp {
|
||||
name: string;
|
||||
siteId: string;
|
||||
siteId?: string;
|
||||
owner?: string;
|
||||
}
|
||||
|
||||
type Props = {
|
||||
@@ -42,7 +43,6 @@ const Integration = ({ integration, environments = [] }: Props) => {
|
||||
slug: ''
|
||||
}
|
||||
);
|
||||
const [fileState, setFileState] = useState([]);
|
||||
const router = useRouter();
|
||||
const [apps, setApps] = useState<IntegrationApp[]>([]); // integration app objects
|
||||
const [integrationApp, setIntegrationApp] = useState(''); // integration app name
|
||||
@@ -51,10 +51,6 @@ const Integration = ({ integration, environments = [] }: Props) => {
|
||||
|
||||
useEffect(() => {
|
||||
const loadIntegration = async () => {
|
||||
interface App {
|
||||
name: string;
|
||||
siteId?: string;
|
||||
}
|
||||
|
||||
const tempApps: [IntegrationApp] = await getIntegrationApps({
|
||||
integrationAuthId: integration.integrationAuth
|
||||
@@ -178,7 +174,8 @@ const Integration = ({ integration, environments = [] }: Props) => {
|
||||
text="Start Integration"
|
||||
onButtonPressed={async () => {
|
||||
const siteApp = apps.find((app) => app.name === integrationApp); // obj or undefined
|
||||
const siteId = siteApp?.siteId ? siteApp.siteId : null;
|
||||
const siteId = siteApp?.siteId ?? null;
|
||||
const owner = siteApp?.owner ?? null;
|
||||
|
||||
await updateIntegration({
|
||||
integrationId: integration._id,
|
||||
@@ -189,9 +186,10 @@ const Integration = ({ integration, environments = [] }: Props) => {
|
||||
context: integrationContext
|
||||
? reverseContextNetlifyMapping[integrationContext]
|
||||
: null,
|
||||
siteId
|
||||
siteId,
|
||||
owner
|
||||
});
|
||||
|
||||
|
||||
router.reload();
|
||||
}}
|
||||
color="mineshaft"
|
||||
|
||||
@@ -12,6 +12,7 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
|
||||
* @param {String} obj.target - (optional) target (environment) for Vercel integration
|
||||
* @param {String} obj.context - (optional) context (environment) for Netlify integration
|
||||
* @param {String} obj.siteId - (optional) app (site_id) for Netlify integration
|
||||
* @param {String} obj.owner - (optional) owner login of repo for GitHub integration
|
||||
* @returns
|
||||
*/
|
||||
const updateIntegration = ({
|
||||
@@ -21,7 +22,8 @@ const updateIntegration = ({
|
||||
isActive,
|
||||
target,
|
||||
context,
|
||||
siteId
|
||||
siteId,
|
||||
owner
|
||||
}: {
|
||||
integrationId: string;
|
||||
app: string;
|
||||
@@ -30,6 +32,7 @@ const updateIntegration = ({
|
||||
target: string | null;
|
||||
context: string | null;
|
||||
siteId: string | null;
|
||||
owner: string | null;
|
||||
}) =>
|
||||
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
|
||||
method: 'PATCH',
|
||||
@@ -42,7 +45,8 @@ const updateIntegration = ({
|
||||
isActive,
|
||||
target,
|
||||
context,
|
||||
siteId
|
||||
siteId,
|
||||
owner
|
||||
})
|
||||
}).then(async (res) => {
|
||||
if (res && res.status === 200) {
|
||||
|
||||
Reference in New Issue
Block a user