fix: runtime環境のXDG_CONFIG_HOME上書きでgh認証が失敗する問題を修正
XDG_CONFIG_HOMEを.takt/.runtime/configに上書きすると、ghがkeyring認証の 設定ファイルを見失い「not authenticated」エラーになる。 XDG_CONFIG_HOME上書き前の元パスをGH_CONFIG_DIRに退避して解決。
This commit is contained in:
parent
1cfae9f53b
commit
dbc22c76fc
@ -23,13 +23,20 @@ function shellQuote(value: string): string {
|
|||||||
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
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<string, string> {
|
function createBaseEnvironment(runtimeRoot: string): Record<string, string> {
|
||||||
|
const ghConfigDir = preserveToolConfigDir('GH_CONFIG_DIR', 'gh');
|
||||||
return {
|
return {
|
||||||
TMPDIR: join(runtimeRoot, 'tmp'),
|
TMPDIR: join(runtimeRoot, 'tmp'),
|
||||||
XDG_CACHE_HOME: join(runtimeRoot, 'cache'),
|
XDG_CACHE_HOME: join(runtimeRoot, 'cache'),
|
||||||
XDG_CONFIG_HOME: join(runtimeRoot, 'config'),
|
XDG_CONFIG_HOME: join(runtimeRoot, 'config'),
|
||||||
XDG_STATE_HOME: join(runtimeRoot, 'state'),
|
XDG_STATE_HOME: join(runtimeRoot, 'state'),
|
||||||
CI: 'true',
|
CI: 'true',
|
||||||
|
GH_CONFIG_DIR: ghConfigDir,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user