mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Add gitPrivateToken (#296)
* adding option to pass git credential * trigger change * trigger change * build dist/index * prettier * adding set git credentials with more config * correct docker.ts input * change default of git credential * try using git command line to set token * remove git config cat * adding api: to git config * change to token * change input name to reflect the type github private token Co-authored-by: Alexander Brandstedt <alexander@infralium.com> Co-authored-by: Alexander Brandstedt <mad01@users.noreply.github.com>
This commit is contained in:
parent
e97ec82110
commit
13fdcad790
@ -110,6 +110,11 @@ inputs:
|
||||
required: false
|
||||
default: ''
|
||||
description: 'SSH Agent path to forward to the container'
|
||||
gitPrivateToken:
|
||||
required: false
|
||||
default: ''
|
||||
description: >
|
||||
Github private token to pull from github
|
||||
chownFilesTo:
|
||||
required: false
|
||||
default: ''
|
||||
|
2
dist/entrypoint.sh
vendored
2
dist/entrypoint.sh
vendored
@ -10,7 +10,7 @@ mkdir -p "$ACTIVATE_LICENSE_PATH"
|
||||
#
|
||||
# Run steps
|
||||
#
|
||||
|
||||
source /steps/set_gitcredential.sh
|
||||
source /steps/activate.sh
|
||||
source /steps/build.sh
|
||||
source /steps/return_license.sh
|
||||
|
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.
24
dist/steps/set_gitcredential.sh
vendored
Executable file
24
dist/steps/set_gitcredential.sh
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "${GIT_PRIVATE_TOKEN}" ]
|
||||
then
|
||||
echo "GIT_PRIVATE_TOKEN unset skipping"
|
||||
else
|
||||
echo "GIT_PRIVATE_TOKEN is set configuring git credentials"
|
||||
|
||||
git config --global credential.helper store
|
||||
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
|
||||
git config --global --add url.https://github.com/.insteadOf git@github.com
|
||||
|
||||
git config --global url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
|
||||
git config --global url."https://ssh:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||
git config --global url."https://git:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
||||
|
||||
fi
|
||||
|
||||
echo "---------- git config --list -------------"
|
||||
git config --list
|
||||
|
||||
echo "---------- git config --list --show-origin -------------"
|
||||
git config --list --show-origin
|
||||
|
@ -12,6 +12,7 @@ export const mockGetFromUser = jest.fn().mockResolvedValue({
|
||||
customParameters: '',
|
||||
sshAgent: '',
|
||||
chownFilesTo: '',
|
||||
gitPrivateToken: '',
|
||||
});
|
||||
|
||||
export default {
|
||||
|
@ -23,6 +23,7 @@ class BuildParameters {
|
||||
public androidKeyaliasPass!: string;
|
||||
public customParameters!: string;
|
||||
public sshAgent!: string;
|
||||
public gitPrivateToken!: string;
|
||||
public remoteBuildCluster!: string;
|
||||
public awsStackName!: string;
|
||||
public kubeConfig!: string;
|
||||
@ -62,6 +63,7 @@ class BuildParameters {
|
||||
androidKeyaliasPass: Input.androidKeyaliasPass,
|
||||
customParameters: Input.customParameters,
|
||||
sshAgent: Input.sshAgent,
|
||||
gitPrivateToken: Input.gitPrivateToken,
|
||||
chownFilesTo: Input.chownFilesTo,
|
||||
remoteBuildCluster: Input.remoteBuildCluster,
|
||||
awsStackName: Input.awsStackName,
|
||||
|
@ -37,6 +37,7 @@ class Docker {
|
||||
androidKeyaliasPass,
|
||||
customParameters,
|
||||
sshAgent,
|
||||
gitPrivateToken,
|
||||
chownFilesTo,
|
||||
} = parameters;
|
||||
|
||||
@ -80,6 +81,7 @@ class Docker {
|
||||
--env RUNNER_TOOL_CACHE \
|
||||
--env RUNNER_TEMP \
|
||||
--env RUNNER_WORKSPACE \
|
||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||
--volume "${runnerTempPath}/_github_home":"/root" \
|
||||
|
@ -89,6 +89,10 @@ class Input {
|
||||
return core.getInput('sshAgent') || '';
|
||||
}
|
||||
|
||||
static get gitPrivateToken() {
|
||||
return core.getInput('gitPrivateToken') || '';
|
||||
}
|
||||
|
||||
static get chownFilesTo() {
|
||||
return core.getInput('chownFilesTo') || '';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user