mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 16:25:39 +08:00
Merge branch 'v3' into fix/vswhere-products
This commit is contained in:
@@ -327,7 +327,7 @@ class Artifact
|
||||
public function getSourceRoot(): string
|
||||
{
|
||||
if (isset($this->config['metadata']['source-root'])) {
|
||||
return $this->getSourceDir() . '/' . ltrim($this->config['metadata']['source-root'], '/');
|
||||
return FileSystem::convertPath($this->getSourceDir() . '/' . ltrim($this->config['metadata']['source-root'], '/'));
|
||||
}
|
||||
return $this->getSourceDir();
|
||||
}
|
||||
|
||||
@@ -223,8 +223,8 @@ class ArtifactCache
|
||||
public function getCacheFullPath(array $cache_info): string
|
||||
{
|
||||
return match ($cache_info['cache_type']) {
|
||||
'archive', 'file' => DOWNLOAD_PATH . '/' . $cache_info['filename'],
|
||||
'git' => DOWNLOAD_PATH . '/' . $cache_info['dirname'],
|
||||
'archive', 'file' => FileSystem::convertPath(DOWNLOAD_PATH . '/' . $cache_info['filename']),
|
||||
'git' => FileSystem::convertPath(DOWNLOAD_PATH . '/' . $cache_info['dirname']),
|
||||
'local' => $cache_info['dirname'], // local dirname is absolute path
|
||||
default => throw new SPCInternalException("Unknown cache type: {$cache_info['cache_type']}"),
|
||||
};
|
||||
|
||||
@@ -16,8 +16,9 @@ trait GitHubTokenSetupTrait
|
||||
// GITHUB_TOKEN support
|
||||
if (($token = getenv('GITHUB_TOKEN')) !== false && ($user = getenv('GITHUB_USER')) !== false) {
|
||||
logger()->debug("Using 'GITHUB_TOKEN' with user {$user} for authentication");
|
||||
spc_add_log_filter([$user, $token]);
|
||||
return ['Authorization: Basic ' . base64_encode("{$user}:{$token}")];
|
||||
$encoded = base64_encode("{$user}:{$token}");
|
||||
spc_add_log_filter([$user, $token, $encoded]);
|
||||
return ["Authorization: Basic {$encoded}"];
|
||||
}
|
||||
if (($token = getenv('GITHUB_TOKEN')) !== false) {
|
||||
logger()->debug("Using 'GITHUB_TOKEN' for authentication");
|
||||
|
||||
@@ -33,6 +33,23 @@ ConsoleLogger::$date_format = 'H:i:s';
|
||||
ConsoleLogger::$format = '[%date% %level_long%] %body%';
|
||||
$ob_logger = new ConsoleLogger(LogLevel::WARNING);
|
||||
|
||||
$ob_logger->addLogCallback(function ($level, &$output, &$message, &$context, bool $shouldLog) {
|
||||
global $spc_log_filters;
|
||||
if (!is_array($spc_log_filters)) {
|
||||
$spc_log_filters = [];
|
||||
}
|
||||
// filter message and context
|
||||
$output = str_replace($spc_log_filters, '***', $output);
|
||||
$message = str_replace($spc_log_filters, '***', $message);
|
||||
$context = array_map(function ($item) use ($spc_log_filters) {
|
||||
if (is_string($item)) {
|
||||
return str_replace($spc_log_filters, '***', $item);
|
||||
}
|
||||
return $item;
|
||||
}, $context);
|
||||
return true;
|
||||
});
|
||||
|
||||
// setup log file
|
||||
if (filter_var(getenv('SPC_ENABLE_LOG_FILE'), FILTER_VALIDATE_BOOLEAN)) {
|
||||
// init spc log files
|
||||
|
||||
Reference in New Issue
Block a user