feat: add task publish and unpublish commands - #1317
Conversation
| task publish Publishes the task on its public landing page. | ||
| task unpublish Unpublishes the task from its public landing |
There was a problem hiding this comment.
Question: I understand those two commands but how can one create/update tasks via CLI so they actually have publicConfig set? publish commands already assumes it is set and valid, right?
|
|
||
| static override description = | ||
| 'Publishes the task on its public landing page.\n' + | ||
| 'The task must belong to a public Actor and have its public display configuration set up ' + |
There was a problem hiding this comment.
Suggestion: Same as on apify-client-js #989 — publishing needs write access to the task and its Actor, which isn't mentioned here.
| }, | ||
| { | ||
| description: 'Publish a task by full ID.', | ||
| command: 'apify task publish E2jjCZBezvAZnX8Rb', |
There was a problem hiding this comment.
Important: This example fails — :42 prefixes the ID with your username, so the API ends up looking for a task named e2jjczbezvaznx8rb instead of resolving the ID. Can we use username/my-task here, like task run does?
|
|
||
| const task = await taskClient.get(); | ||
| if (!task) { | ||
| error({ message: `Cannot find Task with ID or name '${taskId}' in your account.` }); |
There was a problem hiding this comment.
Important: error() only prints to stderr, so both failure paths here exit 0 — a script calling apify task publish can't tell it failed. Probably setting process.exitCode would also make sense here.
| } catch (err) { | ||
| const casted = err as ApifyApiError; | ||
|
|
||
| error({ |
Part of https://github.com/apify/apify-core/issues/29471
Add new commands to publish and un-publish Actor tasks https://github.com/apify/apify-core/pull/29623
Blocked by apify/apify-client-js#989