mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Refactor git configuration for LFS file pulling with token-based authentication
- Enhanced the process of configuring git to use GIT_PRIVATE_TOKEN and GITHUB_TOKEN by clearing existing URL configurations before setting new ones. - Improved the clarity of the URL replacement commands for better readability and maintainability. - This change ensures a more robust setup for pulling LFS files in environments requiring token authentication.
This commit is contained in:
parent
10fc07a79b
commit
1815c3c880
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.
@ -231,14 +231,20 @@ export class RemoteClient {
|
||||
throw new Error('GIT_PRIVATE_TOKEN is not available');
|
||||
}
|
||||
|
||||
// Clear any existing URL configurations
|
||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."https://github.com/".insteadOf`);
|
||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."ssh://git@github.com/".insteadOf`);
|
||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."git@github.com".insteadOf`);
|
||||
|
||||
// Set new URL configuration with token
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --replace-all url."https://token:${gitPrivateToken}@github.com/".insteadOf ssh://git@github.com/`,
|
||||
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "https://github.com/"`,
|
||||
);
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --add url."https://token:${gitPrivateToken}@github.com/".insteadOf git@github.com`,
|
||||
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "ssh://git@github.com/"`,
|
||||
);
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --add url."https://token:${gitPrivateToken}@github.com/".insteadOf "https://github.com/"`,
|
||||
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "git@github.com"`,
|
||||
);
|
||||
|
||||
await CloudRunnerSystem.Run(`git lfs pull`);
|
||||
@ -255,15 +261,20 @@ export class RemoteClient {
|
||||
throw new Error('GITHUB_TOKEN is not available as fallback');
|
||||
}
|
||||
|
||||
// Configure git to use GITHUB_TOKEN
|
||||
// Clear any existing URL configurations
|
||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."https://github.com/".insteadOf`);
|
||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."ssh://git@github.com/".insteadOf`);
|
||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."git@github.com".insteadOf`);
|
||||
|
||||
// Set new URL configuration with token
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --replace-all url."https://token:${githubToken}@github.com/".insteadOf ssh://git@github.com/`,
|
||||
`git config --global url."https://${githubToken}@github.com/".insteadOf "https://github.com/"`,
|
||||
);
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --add url."https://token:${githubToken}@github.com/".insteadOf git@github.com`,
|
||||
`git config --global url."https://${githubToken}@github.com/".insteadOf "ssh://git@github.com/"`,
|
||||
);
|
||||
await CloudRunnerSystem.Run(
|
||||
`git config --global --add url."https://token:${githubToken}@github.com/".insteadOf "https://github.com/"`,
|
||||
`git config --global url."https://${githubToken}@github.com/".insteadOf "git@github.com"`,
|
||||
);
|
||||
|
||||
await CloudRunnerSystem.Run(`git lfs pull`);
|
||||
|
Loading…
Reference in New Issue
Block a user