mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
feat: add support for preview labels in deployment process
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import { db } from "@/server/db";
|
||||
import { applications, compose, github } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import {
|
||||
IS_CLOUD,
|
||||
checkUserRepositoryPermissions,
|
||||
createPreviewDeployment,
|
||||
createSecurityBlockedComment,
|
||||
findGithubById,
|
||||
findPreviewDeploymentByApplicationId,
|
||||
findPreviewDeploymentsByPullRequestId,
|
||||
IS_CLOUD,
|
||||
removePreviewDeployment,
|
||||
shouldDeploy,
|
||||
} from "@dokploy/server";
|
||||
import { Webhooks } from "@octokit/webhooks";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { db } from "@/server/db";
|
||||
import { applications, compose, github } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { extractCommitMessage, extractHash } from "./[refreshToken]";
|
||||
|
||||
export default async function handler(
|
||||
@@ -343,7 +343,9 @@ export default async function handler(
|
||||
if (
|
||||
action === "opened" ||
|
||||
action === "synchronize" ||
|
||||
action === "reopened"
|
||||
action === "reopened" ||
|
||||
action === "labeled" ||
|
||||
action === "unlabeled"
|
||||
) {
|
||||
const repository = githubBody?.repository?.name;
|
||||
const deploymentHash = githubBody?.pull_request?.head?.sha;
|
||||
@@ -443,11 +445,11 @@ export default async function handler(
|
||||
|
||||
for (const app of secureApps) {
|
||||
// check for labels
|
||||
if (app?.previewLabels.size() > 0) {
|
||||
let hasLabel: boolean = false;
|
||||
if (app?.previewLabels && app?.previewLabels?.length > 0) {
|
||||
let hasLabel = false;
|
||||
const labels = githubBody?.pull_request?.labels;
|
||||
for (const label of labels) {
|
||||
if (app?.previewLabels.contains(label.name)) {
|
||||
if (app?.previewLabels?.includes(label.name)) {
|
||||
hasLabel = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -309,6 +309,7 @@ const createSchema = createInsertSchema(applications, {
|
||||
previewCertificateType: z.enum(["letsencrypt", "none", "custom"]).optional(),
|
||||
previewRequireCollaboratorPermissions: z.boolean().optional(),
|
||||
watchPaths: z.array(z.string()).optional(),
|
||||
previewLabels: z.array(z.string()).optional(),
|
||||
cleanCache: z.boolean().optional(),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user