Vectrum
Sign In
12 lines · 530 Bytes · TypeScript
"use server";

import { revalidatePath } from "next/cache";
import { deleteImageVersion } from "@/lib/registry";
import { repoForAction } from "./guard";

/** Deletes a container image version with its tags, platform images and attached signatures. */
export async function deleteImageVersionAction(owner: string, name: string, image: string, digest: string) {
  const { repo } = await repoForAction(owner, name, "write");
  deleteImageVersion(repo.id, image, digest);
  revalidatePath(`/${repo.owner}/${repo.name}`, "layout");
}