Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Using SSH_AUTH_SOCK (ssh agent forwarding) to pull upm private repos #124

Merged
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
sshAgent:
required: false
default: ''
description: 'SSH Agent path to forward to the container'
githubToken:
required: false
default: ''
Expand Down
2 changes: 1 addition & 1 deletion action/index.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function action() {
artifactsPath,
useHostNetwork,
customParameters,
sshAgent,
githubToken,
checkName,
} = Input.getFromUser();
Expand All @@ -31,6 +32,7 @@ async function action() {
artifactsPath,
useHostNetwork,
customParameters,
sshAgent,
githubToken,
});
} finally {
Expand Down
7 changes: 5 additions & 2 deletions src/model/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Docker {
artifactsPath,
useHostNetwork,
customParameters,
sshAgent,
githubToken,
} = parameters;

Expand All @@ -42,7 +43,6 @@ class Docker {
--env TEST_MODE="${testMode}" \
--env ARTIFACTS_PATH="${artifactsPath}" \
--env CUSTOM_PARAMETERS="${customParameters}" \
--env HOME=/github/home \
--env GITHUB_REF \
--env GITHUB_SHA \
--env GITHUB_REPOSITORY \
Expand All @@ -58,10 +58,13 @@ class Docker {
--env RUNNER_TOOL_CACHE \
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "/home/runner/work/_temp/_github_home":"/github/home" \
--volume "/home/runner/work/_temp/_github_home":"/root" \
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
--volume "${workspace}":"/github/workspace" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
${useHostNetwork ? '--net=host' : ''} \
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
${image}`;
Expand Down
2 changes: 2 additions & 0 deletions src/model/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Input {
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
const customParameters = getInput('customParameters') || '';
const sshAgent = getInput('sshAgent') || '';
const githubToken = getInput('githubToken') || '';
const checkName = getInput('checkName') || 'Test Results';

Expand Down Expand Up @@ -58,6 +59,7 @@ class Input {
artifactsPath,
useHostNetwork,
customParameters,
sshAgent,
githubToken,
checkName,
};
Expand Down