[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> </TooltipTrigger>
<TooltipContent> <TooltipContent>
<p> <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> </p>
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>

View File

@ -91,11 +91,16 @@ export default async function handler(
} }
// Handle tag creation event // 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 { try {
const tagName = githubBody?.ref; const tagName = githubBody?.ref;
const repository = githubBody?.repository?.name; 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 deploymentTitle = `Tag created: ${tagName}`;
const deploymentHash = githubBody?.master_branch || ""; const deploymentHash = githubBody?.master_branch || "";
@ -177,15 +182,23 @@ export default async function handler(
const totalApps = apps.length + composeApps.length; const totalApps = apps.length + composeApps.length;
if (totalApps === 0) { 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; 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; return;
} catch (error) { } catch (error) {
console.error("Error deploying applications on tag:", 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; return;
} }
} }