Skip to content

Commit

Permalink
feat: Add additional fields to pages deploy detailed artifact for wra…
Browse files Browse the repository at this point in the history
…ngler-action pages parity
  • Loading branch information
Maximo-Guk committed Nov 19, 2024
1 parent edec415 commit 36cb0ef
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-dryers-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

feat: Add production_branch and deployment_trigger to pages deploy detailed artifact for wrangler-action pages parity
12 changes: 12 additions & 0 deletions packages/wrangler/src/__tests__/output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -215,6 +221,12 @@ describe("writeOutput()", () => {
url: "test.com",
alias: "dev.com",
environment: "production",
production_branch: "production-branch",
deployment_trigger: {
metadata: {
commit_hash: "bc286bd30cf12b7fdbce046be6e53ce12ae1283d",
},
},
},
]);
});
Expand Down
8 changes: 8 additions & 0 deletions packages/wrangler/src/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"> {
Expand Down
7 changes: 7 additions & 0 deletions packages/wrangler/src/pages/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 36cb0ef

Please sign in to comment.