add private github package support using personal access token (#152)
* add private github package support using pat * add index.js after yarn build * shift gitcrediental step before run_testspull/151/head^2
parent
a2b1ed6631
commit
576ef39bb6
|
@ -19,7 +19,7 @@ When fixing a bug it is fine to submit a pull request right away.
|
|||
|
||||
Steps to be performed to submit a pull request:
|
||||
|
||||
1. Fork the repository and create your branch from `master`.
|
||||
1. Fork the repository and create your branch from `main`.
|
||||
2. Run `yarn` in the repository root.
|
||||
3. If you've fixed a bug or added code that should be tested, add tests!
|
||||
4. Fill out the description, link any related issues and submit your pull request.
|
||||
|
|
|
@ -32,6 +32,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
|
||||
githubToken:
|
||||
required: false
|
||||
default: ''
|
||||
|
|
|
@ -12,6 +12,7 @@ mkdir -p "$ACTIVATE_LICENSE_PATH"
|
|||
#
|
||||
|
||||
source /steps/activate.sh
|
||||
source /steps/set_gitcredential.sh
|
||||
source /steps/run_tests.sh
|
||||
source /steps/return_license.sh
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,23 @@
|
|||
#!/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
|
|
@ -28,6 +28,7 @@ class Docker {
|
|||
customParameters,
|
||||
sshAgent,
|
||||
githubToken,
|
||||
gitPrivateToken,
|
||||
} = parameters;
|
||||
|
||||
const command = `docker run \
|
||||
|
@ -58,6 +59,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 "/home/runner/work/_temp/_github_home":"/root" \
|
||||
|
|
|
@ -25,6 +25,7 @@ class Input {
|
|||
const sshAgent = getInput('sshAgent') || '';
|
||||
const githubToken = getInput('githubToken') || '';
|
||||
const checkName = getInput('checkName') || 'Test Results';
|
||||
const gitPrivateToken = getInput('gitPrivateToken') || '';
|
||||
|
||||
// Validate input
|
||||
if (!includes(this.testModes, testMode)) {
|
||||
|
@ -62,6 +63,7 @@ class Input {
|
|||
sshAgent,
|
||||
githubToken,
|
||||
checkName,
|
||||
gitPrivateToken,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue