Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional fields to pages deploy detailed artifact #7252

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ?? "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what circumstances would deployment_trigger ever be undefined?

Copy link
Member Author

@Maximo-Guk Maximo-Guk Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, it's not a required field in our openapi schema https://developers.cloudflare.com/api/operations/pages-deployment-create-deployment

Also we handle undefined case here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Pages Direct Upload deployments, I believe the git ref is optional because you could deploy a Pages project that is not in a repo

},
},
});

await metrics.sendMetricsEvent("create pages deployment");
Expand Down
Loading