Only pass wrapper defaultSettingSources when project config was restored from base

🏠 Remote-Dev: homespace
This commit is contained in:
Octavian Guzu 2026-04-23 17:40:41 +00:00
parent 044a1036f6
commit b6dac6f121
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View File

@ -63,7 +63,7 @@ inputs:
required: false
default: ""
setting_sources:
description: "Comma-separated list of setting sources to load (user, project, local). When unset, the action applies 'user,project,local' at runtime — project settings are safe here because .claude/ is restored from the PR base branch before execution. Set to 'user' to ignore in-repo settings entirely."
description: "Comma-separated list of setting sources to load (user, project, local). When unset, the action applies 'user,project,local' at runtime for PR contexts where .claude/ is restored from the base branch; for other contexts it applies the same event-gated default as base-action. Set to 'user' to ignore in-repo settings entirely."
required: false
default: ""

View File

@ -241,6 +241,7 @@ async function run() {
// lacks base.ref, so we fall back to the mode-provided value — tag mode
// fetches it from GraphQL; agent mode on issue_comment is an edge case
// that at worst restores from the wrong trusted branch (still secure).
let configRestoredFromBase = false;
if (isEntityContext(context) && context.isPR) {
let restoreBase = baseBranch;
if (
@ -253,6 +254,7 @@ async function run() {
}
if (restoreBase) {
restoreConfigFromBase(restoreBase);
configRestoredFromBase = true;
}
}
@ -279,7 +281,12 @@ async function run() {
pathToClaudeCodeExecutable: claudeExecutable,
showFullOutput: process.env.INPUT_SHOW_FULL_OUTPUT,
settingSources: process.env.INPUT_SETTING_SOURCES,
defaultSettingSources: ["user", "project", "local"],
// Only assert that project/local config is safe to load when it was actually
// restored from the base branch above. Otherwise leave undefined so
// parseSdkOptions applies its event-gated default.
defaultSettingSources: configRestoredFromBase
? ["user", "project", "local"]
: undefined,
});
claudeSuccess = claudeResult.conclusion === "success";