[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2025-04-06 08:59:02 +00:00 committed by GitHub
parent fcb8a2bded
commit e5ee06b67e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 8 deletions

View File

@ -396,7 +396,8 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
</TooltipTrigger>
<TooltipContent>
<p>
Choose when to trigger deployments: on push to the selected branch or when a new tag is created.
Choose when to trigger deployments: on push to the
selected branch or when a new tag is created.
</p>
</TooltipContent>
</Tooltip>

View File

@ -91,11 +91,16 @@ export default async function handler(
}
// Handle tag creation event
if (req.headers["x-github-event"] === "create" && githubBody?.ref_type === "tag") {
if (
req.headers["x-github-event"] === "create" &&
githubBody?.ref_type === "tag"
) {
try {
const tagName = githubBody?.ref;
const repository = githubBody?.repository?.name;
const owner = githubBody?.repository?.owner?.name || githubBody?.repository?.owner?.login;
const owner =
githubBody?.repository?.owner?.name ||
githubBody?.repository?.owner?.login;
const deploymentTitle = `Tag created: ${tagName}`;
const deploymentHash = githubBody?.master_branch || "";
@ -175,17 +180,25 @@ export default async function handler(
}
const totalApps = apps.length + composeApps.length;
if (totalApps === 0) {
res.status(200).json({ message: "No apps configured to deploy on tag" });
res
.status(200)
.json({ message: "No apps configured to deploy on tag" });
return;
}
res.status(200).json({ message: `Deployed ${totalApps} apps based on tag ${tagName}` });
res
.status(200)
.json({
message: `Deployed ${totalApps} apps based on tag ${tagName}`,
});
return;
} catch (error) {
console.error("Error deploying applications on tag:", error);
res.status(400).json({ message: "Error deploying applications on tag", error });
res
.status(400)
.json({ message: "Error deploying applications on tag", error });
return;
}
}