//native
type Vercel = {
token: string;
};
/**
* Update deployment integration action
* Updates the deployment integration action for the specified integration installation
*/
export async function main(
auth: Vercel,
deploymentId: string,
integrationConfigurationId: string,
resourceId: string,
action: string,
body: {
status?: "running" | "succeeded" | "failed";
statusText?: string;
outcomes?: {
kind: "resource-secrets";
secrets: { name: string; value: string }[];
}[];
},
) {
const url = new URL(
`https://api.vercel.com/v1/deployments/${deploymentId}/integrations/${integrationConfigurationId}/resources/${resourceId}/actions/${action}`,
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago