fix(cli): read wmill.yaml from the branch a git-sync deploy writes to (#11236)

* fix(cli): read wmill.yaml from the branch a git-sync deploy writes to

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(cli): create the stateful dir once the deploy branch's config is read

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-09-18 20:50:23 +02:00
committed by GitHub
co-authored by Claude Opus 5
parent 8f9a94328c
commit 974b0265f8
2 changed files with 112 additions and 10 deletions
+21 -10
View File
@@ -3594,12 +3594,15 @@ export async function pull(
) {
if ((opts as any).jsonOutput) log.setSilent(true);
const originalCliOpts = { ...opts };
opts = await mergeConfigWithConfigFile(opts);
// --include-secrets overrides skipSecrets from wmill.yaml
if ((originalCliOpts as any).includeSecrets) {
opts.skipSecrets = false;
}
const withConfigFile = async () => {
const merged = await mergeConfigWithConfigFile({ ...originalCliOpts });
// --include-secrets overrides skipSecrets from wmill.yaml
if ((originalCliOpts as any).includeSecrets) {
merged.skipSecrets = false;
}
return merged;
};
opts = await withConfigFile();
// Resolve workspace name for config lookups.
// --branch resolves git branch → workspace name (deprecated but still supported).
@@ -3634,10 +3637,6 @@ export async function pull(
throw error;
}
if (opts.stateful) {
await mkdir(path.join(process.cwd(), ".wmill"), { recursive: true });
}
const workspace = await resolveWorkspace(opts, wsNameForConfig);
await requireLogin(opts);
@@ -3729,6 +3728,14 @@ export async function pull(
});
return;
}
// The pull writes into the branch now checked out, so its wmill.yaml
// applies, not the cloned branch's: a fork branch that turned on
// `dedupeLockfiles` would otherwise get one lockfile per script back.
if (getCurrentGitBranch() !== clonedBranchName) {
opts = await withConfigFile();
wsNameForConfig = resolveWsNameForConfigFromFlags(opts);
}
}
// If wsNameForConfig wasn't set from flags, infer from the resolved profile
@@ -3763,6 +3770,10 @@ export async function pull(
// Merge CLI flags with resolved settings (CLI flags take precedence only for explicit overrides)
opts = mergeCliWithEffectiveOptions(originalCliOpts, effectiveOpts);
if (opts.stateful) {
await mkdir(path.join(process.cwd(), ".wmill"), { recursive: true });
}
const codebases = await listSyncCodebases(opts);
log.info(