Skip to content

Commit

Permalink
add field for workflow in project settings
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes committed Nov 22, 2024
1 parent 195f4bd commit e5bdc53
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ model projects {
organizations organizations @relation(fields: [organization_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_projects_organization")
repos repos @relation(fields: [repo_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_projects_repo")
teams teams? @relation(fields: [team_id], references: [id], onDelete: Cascade)
workflow String
}

/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type ProjectSettingsFormData = {
is_drift_detection_enabled: boolean;
drift_crontab: string;
auto_approve: boolean;
workflow: string; // digger.yml workflow
};

export default function ProjectSettings({ project, repositoryName }: ProjectSettingsProps) {
Expand All @@ -48,6 +49,7 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
is_drift_detection_enabled: project.is_drift_detection_enabled || false,
drift_crontab: project.drift_crontab || '',
auto_approve: project.auto_approve || false,
workflow: project.workflow || "default",
},
});

Expand All @@ -66,6 +68,7 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
is_drift_detection_enabled: data.is_drift_detection_enabled,
drift_crontab: data.drift_crontab,
auto_approve: data.auto_approve,
workflow: data.workflow
});
return result;
},
Expand Down Expand Up @@ -136,6 +139,22 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
/>
</motion.div>


<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.15, delay: 0.4 }}
>
<Label htmlFor="workflow">workflow (digger.yml)</Label>
<Controller
name="workflow"
control={control}
render={({ field }) => (
<Input id="workflow" {...field} />
)}
/>
</motion.div>

<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
Expand Down Expand Up @@ -186,7 +205,7 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
animate={{ opacity: 1 }}
transition={{ duration: 0.15, delay: 0.4 }}
>
<Label htmlFor="workflow_file">Workflow file</Label>
<Label htmlFor="workflow_file">Workflow file (github action workflow)</Label>
<Controller
name="workflow_file"
control={control}
Expand Down
3 changes: 3 additions & 0 deletions src/data/user/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ export async function updateProjectSettingsAction({
is_drift_detection_enabled,
drift_crontab,
auto_approve,
workflow,
}: {
projectId: string;
terraformWorkingDir: string;
Expand All @@ -995,6 +996,7 @@ export async function updateProjectSettingsAction({
is_drift_detection_enabled: boolean;
drift_crontab: string;
auto_approve: boolean;
workflow: string;
}): Promise<SAPayload<projects>> {
const prisma = new PrismaClient();

Expand All @@ -1015,6 +1017,7 @@ export async function updateProjectSettingsAction({
is_drift_detection_enabled,
drift_crontab,
auto_approve,
workflow,
}
});

Expand Down

0 comments on commit e5bdc53

Please sign in to comment.