Skip to content

feat: add task publish and unpublish commands - #1317

Open
Janjiran wants to merge 1 commit into
masterfrom
feat/task-publication
Open

feat: add task publish and unpublish commands#1317
Janjiran wants to merge 1 commit into
masterfrom
feat/task-publication

Conversation

@Janjiran

@Janjiran Janjiran commented Aug 3, 2026

Copy link
Copy Markdown

@Janjiran Janjiran added this to the 146th sprint - Growth team milestone Aug 3, 2026
@Janjiran Janjiran self-assigned this Aug 3, 2026
@Janjiran Janjiran added the t-growth Issues owned by the Growth team. label Aug 3, 2026
@Janjiran
Janjiran requested a review from katzino August 3, 2026 06:47
Comment thread docs/reference.md
Comment on lines +1622 to +1623
task publish Publishes the task on its public landing page.
task unpublish Unpublishes the task from its public landing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ' +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.` });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-growth Issues owned by the Growth team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants