mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04: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:
parent
db9fc17071
commit
10fc07a79b
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -224,6 +224,23 @@ export class RemoteClient {
|
||||
if (!CloudRunner.buildParameters.skipLfs) {
|
||||
try {
|
||||
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 CloudRunnerSystem.Run(
|
||||
`git config --global --replace-all url."https://token:${gitPrivateToken}@github.com/".insteadOf ssh://git@github.com/`,
|
||||
);
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --add url."https://token:${gitPrivateToken}@github.com/".insteadOf git@github.com`,
|
||||
);
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --add url."https://token:${gitPrivateToken}@github.com/".insteadOf "https://github.com/"`,
|
||||
);
|
||||
|
||||
await CloudRunnerSystem.Run(`git lfs pull`);
|
||||
RemoteClientLogger.log(`Successfully pulled LFS files with GIT_PRIVATE_TOKEN`);
|
||||
assert(fs.existsSync(CloudRunnerFolders.lfsFolderAbsolute));
|
||||
|
Loading…
Reference in New Issue
Block a user