Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions __tests__/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('getInputs', () => {
rootless: false,
setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -57,6 +58,7 @@ describe('getInputs', () => {
rootless: false,
setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -76,6 +78,7 @@ describe('getInputs', () => {
rootless: false,
setHost: true,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -97,6 +100,7 @@ describe('getInputs', () => {
rootless: false,
setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -116,6 +120,7 @@ describe('getInputs', () => {
rootless: false,
setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -136,6 +141,7 @@ describe('getInputs', () => {
daemonConfig: '',
rootless: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -156,6 +162,7 @@ describe('getInputs', () => {
daemonConfig: '',
rootless: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -175,6 +182,7 @@ describe('getInputs', () => {
daemonConfig: '',
rootless: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -194,6 +202,7 @@ describe('getInputs', () => {
daemonConfig: '',
rootless: true,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
[
Expand All @@ -216,6 +225,7 @@ describe('getInputs', () => {
rootless: false,
setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '',
} as context.Inputs
],
])(
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ inputs:
runtime-basedir:
description: 'Docker runtime base directory'
required: false
github-token:
description: "GitHub Token used to get releases and download assets"
default: ${{ github.token }}
required: false

outputs:
sock:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface Inputs {
setHost: boolean;
rootless: boolean;
runtimeBasedir: string;
githubToken: string;
}

export function getInputs(): Inputs {
Expand All @@ -31,7 +32,8 @@ export function getInputs(): Inputs {
context: core.getInput('context'),
setHost: core.getBooleanInput('set-host'),
rootless: core.getBooleanInput('rootless'),
runtimeBasedir: core.getInput('runtime-basedir') || path.join(os.homedir(), `setup-docker-action`)
runtimeBasedir: core.getInput('runtime-basedir') || path.join(os.homedir(), `setup-docker-action`),
githubToken: core.getInput('github-token')
};
}

Expand Down
7 changes: 4 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ actionsToolkit.run(

if (input.source.type === 'image') {
await core.group(`Download and install regctl`, async () => {
const regclientInstall = new RegclientInstall();
const regclientInstall = new RegclientInstall({githubToken: input.githubToken});
const regclientBinPath = await regclientInstall.download(
process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim()
? process.env.REGCTL_VERSION
Expand All @@ -35,7 +35,7 @@ actionsToolkit.run(
await regclientInstall.install(regclientBinPath);
});
await core.group(`Download and install undock`, async () => {
const undockInstall = new UndockInstall();
const undockInstall = new UndockInstall({githubToken: input.githubToken});
const undockBinPath = await undockInstall.download(
process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim()
? process.env.UNDOCK_VERSION
Expand All @@ -59,7 +59,8 @@ actionsToolkit.run(
rootless: input.rootless,
contextName: input.context || 'setup-docker-action',
daemonConfig: input.daemonConfig,
localTCPPort: tcpPort
localTCPPort: tcpPort,
githubToken: input.githubToken
});
let toolDir;
if (!(await Docker.isAvailable()) || input.source) {
Expand Down
Loading