Skip to content

Commit 2b399b2

Browse files
authoredApr 5, 2022
Add gitPrivateToken support again (#377)
1 parent 40891d6 commit 2b399b2

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed
 

‎dist/index.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/platforms/ubuntu/steps/set_gitcredential.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ else
77
echo "GIT_PRIVATE_TOKEN is set configuring git credentials"
88

99
git config --global credential.helper store
10-
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
11-
git config --global --add url.https://github.com/.insteadOf git@github.com
10+
git config --global --replace-all url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf ssh://git@github.com/
11+
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf git@github.com
1212

1313
git config --global url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
1414
git config --global url."https://ssh:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"

‎src/model/docker.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Docker {
1717
}
1818

1919
static getLinuxCommand(image, parameters): string {
20-
const { workspace, actionFolder, runnerTempPath, sshAgent } = parameters;
20+
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
2121

2222
const githubHome = path.join(runnerTempPath, '_github_home');
2323
if (!existsSync(githubHome)) mkdirSync(githubHome);
@@ -30,6 +30,7 @@ class Docker {
3030
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
3131
--env UNITY_SERIAL \
3232
--env GITHUB_WORKSPACE=/github/workspace \
33+
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
3334
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
3435
--volume "${githubHome}":"/root:z" \
3536
--volume "${githubWorkflow}":"/github/workflow:z" \
@@ -44,13 +45,14 @@ class Docker {
4445
}
4546

4647
static getWindowsCommand(image: any, parameters: any): string {
47-
const { workspace, actionFolder, unitySerial } = parameters;
48+
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
4849
return `docker run \
4950
--workdir /github/workspace \
5051
--rm \
5152
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
5253
--env UNITY_SERIAL="${unitySerial}" \
5354
--env GITHUB_WORKSPACE=c:/github/workspace \
55+
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
5456
--volume "${workspace}":"c:/github/workspace" \
5557
--volume "c:/regkeys":"c:/regkeys" \
5658
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \

0 commit comments

Comments
 (0)