From dbc22c76fc9e8c672b570c6224c12693fa92b0cf Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Wed, 4 Mar 2026 23:03:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20runtime=E7=92=B0=E5=A2=83=E3=81=AEXDG=5F?= =?UTF-8?q?CONFIG=5FHOME=E4=B8=8A=E6=9B=B8=E3=81=8D=E3=81=A7gh=E8=AA=8D?= =?UTF-8?q?=E8=A8=BC=E3=81=8C=E5=A4=B1=E6=95=97=E3=81=99=E3=82=8B=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XDG_CONFIG_HOMEを.takt/.runtime/configに上書きすると、ghがkeyring認証の 設定ファイルを見失い「not authenticated」エラーになる。 XDG_CONFIG_HOME上書き前の元パスをGH_CONFIG_DIRに退避して解決。 --- src/core/runtime/runtime-environment.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/runtime/runtime-environment.ts b/src/core/runtime/runtime-environment.ts index 88b1ca5..38a81d6 100644 --- a/src/core/runtime/runtime-environment.ts +++ b/src/core/runtime/runtime-environment.ts @@ -23,13 +23,20 @@ function shellQuote(value: string): string { return `'${value.replace(/'/g, `'"'"'`)}'`; } +function preserveToolConfigDir(envKey: string, xdgSubdir: string): string { + return process.env[envKey] + ?? join(process.env['XDG_CONFIG_HOME'] ?? join(process.env['HOME']!, '.config'), xdgSubdir); +} + function createBaseEnvironment(runtimeRoot: string): Record { + const ghConfigDir = preserveToolConfigDir('GH_CONFIG_DIR', 'gh'); return { TMPDIR: join(runtimeRoot, 'tmp'), XDG_CACHE_HOME: join(runtimeRoot, 'cache'), XDG_CONFIG_HOME: join(runtimeRoot, 'config'), XDG_STATE_HOME: join(runtimeRoot, 'state'), CI: 'true', + GH_CONFIG_DIR: ghConfigDir, }; }