Skip to content

feat: ask before apify push drops a Git source - #1378

Merged
l2ysho merged 6 commits into
masterfrom
claude/apify-cli-1142-8acca6
Sep 2, 2026
Merged

feat: ask before apify push drops a Git source#1378
l2ysho merged 6 commits into
masterfrom
claude/apify-cli-1142-8acca6

Conversation

@l2ysho

@l2ysho l2ysho commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

TL;DRapify push on a Git-sourced Actor version now says what it is about to drop and asks before it switches the source to the local files. --force answers yes. Without a terminal and without --force, the push stops.

Closes #1142.

What happened before

apify push set the version's sourceType to SOURCE_FILES without a word. The Git connection and its build setup were gone before anyone noticed, and the platform kept building from the uploaded files. See the issue comments for the agreed shape of the prompt.

What changed

  • The version is fetched before the upload, not after. When its source type is GIT_REPO, the command prints a warning with the repository URL, points at git push as the way to build from the repository, and asks:

    Warning: Actor my-scraper builds from a Git repository: git@github.com:apify/my-scraper.git
    A push replaces that source with the local files and drops the Git connection.
    To build from the repository, run git push instead. The platform builds on push when Automatic builds are on.
    ? Switch the source to the local files? (y/N)
    

    The question comes after the "modified on the platform" check, so nobody confirms a push that is about to be refused anyway.

  • No stops the push before anything is uploaded. The Actor is untouched.

  • --force skips the question but keeps the warning. Its description now covers both cases it overrides: a newer remote version, and a Git source.

  • Non-interactive runs without --force stop with an error that names the flag. This is a behavior change for CI pipelines that push to a Git-sourced Actor. Such a pipeline is replacing the repository source on every run, so it should say so explicitly.

  • Source-files and tarball versions are not affected. No prompt, no new output.

The second half of the issue

"After switching back to Git, Automatic builds could not be enabled." The API only $sets the keys it receives, so apify push leaves gitRepoUrl and githubWebhookId on the version and flips sourceType only. Whether Console then re-creates the version fields on switch-back is a platform question. Not touched here, and the prompt above removes the usual way into it.

Relation to #1377

#1377 turns Automatic builds on for Actors that apify create --source <provider> makes. This PR is independent of it and applies on master. The warning text says "when Automatic builds are on" rather than promising a build, since a Console-created Actor may have them off.

Verification

lint, format, build, test:local clean. docs/reference.md regenerated for the --force description.

7 new tests in test/local/commands/push-git-source.test.ts, with the platform client mocked: the non-interactive stop leaves the version untouched and names --force; no leaves it untouched; yes and --force switch the source to SOURCE_FILES, and --force never reaches the prompt; source-files and tarball versions neither ask nor warn.

Not run live against a real Git-sourced Actor yet. Draft until that is done.


🤖 Generated with Claude Code

`apify push` on a Git-sourced version switched the source type to the
local files without a word, so the Git connection was gone before anyone
noticed. Now it warns with the repository URL, points at `git push`, and
asks. `--force` skips the question. Without a terminal and without it,
the push stops.

Closes #1142.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the 148th sprint - Tooling team milestone Sep 2, 2026
@github-actions github-actions Bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Sep 2, 2026
}) => {
warning({
message: [
`Actor ${actorName} builds from a Git repository: ${gitRepoUrl}`,

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.

@szaganek please can you review the message?

@l2ysho
l2ysho marked this pull request as ready for review September 2, 2026 08:14
Comment thread src/commands/actors/push.ts Outdated
Comment thread src/commands/actors/push.ts Outdated
Comment thread src/commands/actors/push.ts Outdated
l2ysho and others added 4 commits September 2, 2026 11:40
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
@l2ysho
l2ysho enabled auto-merge (squash) September 2, 2026 09:43
The copy edits on the branch changed both the Git-source hint and the
"newer on the platform" error. Point the assertions at the new wording.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@l2ysho
l2ysho merged commit 6667817 into master Sep 2, 2026
24 checks passed
@l2ysho
l2ysho deleted the claude/apify-cli-1142-8acca6 branch September 2, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After a apify push from CLI, Github linked Actor fails to switch back to the "Automatic builds" option

5 participants