mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-12-06 07:48:13 +08:00
set github token to list releases and download assets
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -34,6 +34,7 @@ describe('getInputs', () => {
|
|||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -57,6 +58,7 @@ describe('getInputs', () => {
|
|||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -76,6 +78,7 @@ describe('getInputs', () => {
|
|||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: true,
|
setHost: true,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -97,6 +100,7 @@ describe('getInputs', () => {
|
|||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -116,6 +120,7 @@ describe('getInputs', () => {
|
|||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -136,6 +141,7 @@ describe('getInputs', () => {
|
|||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -156,6 +162,7 @@ describe('getInputs', () => {
|
|||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -175,6 +182,7 @@ describe('getInputs', () => {
|
|||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -194,6 +202,7 @@ describe('getInputs', () => {
|
|||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: true,
|
rootless: true,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -216,6 +225,7 @@ describe('getInputs', () => {
|
|||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
])(
|
])(
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ inputs:
|
|||||||
runtime-basedir:
|
runtime-basedir:
|
||||||
description: 'Docker runtime base directory'
|
description: 'Docker runtime base directory'
|
||||||
required: false
|
required: false
|
||||||
|
github-token:
|
||||||
|
description: "GitHub Token used to get releases and download assets"
|
||||||
|
default: ${{ github.token }}
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
sock:
|
sock:
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export interface Inputs {
|
|||||||
setHost: boolean;
|
setHost: boolean;
|
||||||
rootless: boolean;
|
rootless: boolean;
|
||||||
runtimeBasedir: string;
|
runtimeBasedir: string;
|
||||||
|
githubToken: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
@@ -31,7 +32,8 @@ export function getInputs(): Inputs {
|
|||||||
context: core.getInput('context'),
|
context: core.getInput('context'),
|
||||||
setHost: core.getBooleanInput('set-host'),
|
setHost: core.getBooleanInput('set-host'),
|
||||||
rootless: core.getBooleanInput('rootless'),
|
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')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ actionsToolkit.run(
|
|||||||
|
|
||||||
if (input.source.type === 'image') {
|
if (input.source.type === 'image') {
|
||||||
await core.group(`Download and install regctl`, async () => {
|
await core.group(`Download and install regctl`, async () => {
|
||||||
const regclientInstall = new RegclientInstall();
|
const regclientInstall = new RegclientInstall({githubToken: input.githubToken});
|
||||||
const regclientBinPath = await regclientInstall.download(
|
const regclientBinPath = await regclientInstall.download(
|
||||||
process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim()
|
process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim()
|
||||||
? process.env.REGCTL_VERSION
|
? process.env.REGCTL_VERSION
|
||||||
@@ -35,7 +35,7 @@ actionsToolkit.run(
|
|||||||
await regclientInstall.install(regclientBinPath);
|
await regclientInstall.install(regclientBinPath);
|
||||||
});
|
});
|
||||||
await core.group(`Download and install undock`, async () => {
|
await core.group(`Download and install undock`, async () => {
|
||||||
const undockInstall = new UndockInstall();
|
const undockInstall = new UndockInstall({githubToken: input.githubToken});
|
||||||
const undockBinPath = await undockInstall.download(
|
const undockBinPath = await undockInstall.download(
|
||||||
process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim()
|
process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim()
|
||||||
? process.env.UNDOCK_VERSION
|
? process.env.UNDOCK_VERSION
|
||||||
@@ -59,7 +59,8 @@ actionsToolkit.run(
|
|||||||
rootless: input.rootless,
|
rootless: input.rootless,
|
||||||
contextName: input.context || 'setup-docker-action',
|
contextName: input.context || 'setup-docker-action',
|
||||||
daemonConfig: input.daemonConfig,
|
daemonConfig: input.daemonConfig,
|
||||||
localTCPPort: tcpPort
|
localTCPPort: tcpPort,
|
||||||
|
githubToken: input.githubToken
|
||||||
});
|
});
|
||||||
let toolDir;
|
let toolDir;
|
||||||
if (!(await Docker.isAvailable()) || input.source) {
|
if (!(await Docker.isAvailable()) || input.source) {
|
||||||
|
|||||||
Reference in New Issue
Block a user