Skip to content

Commit

Permalink
feat: change trigger command to comply with new endpoint (#7067)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisDuarte1 authored Oct 23, 2024
1 parent a90980c commit 4aa35c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/grumpy-eggs-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Change trigger command to comply with the current workflows endpoint.

This also adds an id option to allow users to optionally customize the new instance id.
12 changes: 11 additions & 1 deletion packages/wrangler/src/workflows/commands/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ defineCommand({
type: "string",
default: "",
},
id: {
describe:
"Custom instance ID, if not provided it will default to a random UUIDv4",
type: "string",
default: undefined,
},
},
positionalArgs: ["name", "params"],

Expand All @@ -45,7 +51,11 @@ defineCommand({
`/accounts/${accountId}/workflows/${args.name}/instances`,
{
method: "POST",
body: args.params.length != 0 ? args.params : undefined,
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
instance_id: args.id,
params: args.params.length != 0 ? args.params : undefined,
}),
}
);

Expand Down

0 comments on commit 4aa35c5

Please sign in to comment.