From d5c37f94953c794712bd13cfe35aa116b3b62347 Mon Sep 17 00:00:00 2001 From: Maximo Guk <62088388+Maximo-Guk@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:30:15 -0600 Subject: [PATCH] feat: Add additional fields to pages deploy detailed artifact for wrangler-action pages parity --- .changeset/curly-dryers-admire.md | 5 +++++ packages/wrangler/src/__tests__/output.test.ts | 12 ++++++++++++ packages/wrangler/src/output.ts | 8 ++++++++ packages/wrangler/src/pages/deploy.ts | 7 +++++++ 4 files changed, 32 insertions(+) create mode 100644 .changeset/curly-dryers-admire.md diff --git a/.changeset/curly-dryers-admire.md b/.changeset/curly-dryers-admire.md new file mode 100644 index 000000000000..fdc93f3efe9b --- /dev/null +++ b/.changeset/curly-dryers-admire.md @@ -0,0 +1,5 @@ +--- +"wrangler": minor +--- + +feat: Add production_branch and deployment_trigger to pages deploy detailed artifact for wrangler-action pages parity diff --git a/packages/wrangler/src/__tests__/output.test.ts b/packages/wrangler/src/__tests__/output.test.ts index 6124c72660eb..c5e0fccd3e1c 100644 --- a/packages/wrangler/src/__tests__/output.test.ts +++ b/packages/wrangler/src/__tests__/output.test.ts @@ -193,6 +193,12 @@ describe("writeOutput()", () => { url: "test.com", alias: "dev.com", environment: "production", + production_branch: "production-branch", + deployment_trigger: { + metadata: { + commit_hash: "bc286bd30cf12b7fdbce046be6e53ce12ae1283d", + }, + }, }); const outputFilePaths = readdirSync("output"); @@ -215,6 +221,12 @@ describe("writeOutput()", () => { url: "test.com", alias: "dev.com", environment: "production", + production_branch: "production-branch", + deployment_trigger: { + metadata: { + commit_hash: "bc286bd30cf12b7fdbce046be6e53ce12ae1283d", + }, + }, }, ]); }); diff --git a/packages/wrangler/src/output.ts b/packages/wrangler/src/output.ts index 7a85768edabb..1908c39917b4 100644 --- a/packages/wrangler/src/output.ts +++ b/packages/wrangler/src/output.ts @@ -118,6 +118,14 @@ interface OutputEntryPagesDeploymentDetailed alias: string | undefined; /** The environment being deployed to */ environment: "production" | "preview"; + /** The production branch of the pages project */ + production_branch: string; + deployment_trigger: { + metadata: { + /** Commit hash of the deployment trigger metadata for the pages project */ + commit_hash: string; + }; + }; } interface OutputEntryVersionUpload extends OutputEntryBase<"version-upload"> { diff --git a/packages/wrangler/src/pages/deploy.ts b/packages/wrangler/src/pages/deploy.ts index e8a3e85298fc..9f5174e24bd3 100644 --- a/packages/wrangler/src/pages/deploy.ts +++ b/packages/wrangler/src/pages/deploy.ts @@ -454,6 +454,13 @@ ${failureMessage}`, url: deploymentResponse.url, alias, environment: deploymentResponse.environment, + production_branch: deploymentResponse.production_branch, + deployment_trigger: { + metadata: { + commit_hash: + deploymentResponse.deployment_trigger?.metadata?.commit_hash ?? "", + }, + }, }); await metrics.sendMetricsEvent("create pages deployment");