mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-14 20:16:48 -07:00
Enhance LFS file pulling by configuring git for token-based authentication
- Added configuration to use GIT_PRIVATE_TOKEN for git operations, replacing SSH and HTTPS URLs with token-based authentication. - Improved error handling to ensure GIT_PRIVATE_TOKEN availability before attempting to pull LFS files. - This change streamlines the process of pulling LFS files in environments requiring token authentication.
This commit is contained in:
+8
@@ -4627,6 +4627,14 @@ class RemoteClient {
|
||||
if (!cloud_runner_1.default.buildParameters.skipLfs) {
|
||||
try {
|
||||
remote_client_logger_1.RemoteClientLogger.log(`Attempting to pull LFS files with GIT_PRIVATE_TOKEN...`);
|
||||
// Configure git to use GIT_PRIVATE_TOKEN
|
||||
const gitPrivateToken = process.env.GIT_PRIVATE_TOKEN;
|
||||
if (!gitPrivateToken) {
|
||||
throw new Error('GIT_PRIVATE_TOKEN is not available');
|
||||
}
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git config --global --replace-all url."https://token:${gitPrivateToken}@github.com/".insteadOf ssh://git@github.com/`);
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git config --global --add url."https://token:${gitPrivateToken}@github.com/".insteadOf git@github.com`);
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git config --global --add url."https://token:${gitPrivateToken}@github.com/".insteadOf "https://github.com/"`);
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git lfs pull`);
|
||||
remote_client_logger_1.RemoteClientLogger.log(`Successfully pulled LFS files with GIT_PRIVATE_TOKEN`);
|
||||
(0, node_console_1.assert)(node_fs_1.default.existsSync(cloud_runner_folders_1.CloudRunnerFolders.lfsFolderAbsolute));
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user