mirror of
https://github.com/docker/login-action.git
synced 2025-04-27 17:16:35 +02:00
Mostly tests and some small changes (#16)
* Create docker.test.ts * Add context tests * test main
This commit is contained in:
parent
34d5f75b0d
commit
4b15841c41
5 changed files with 148 additions and 8 deletions
|
@ -7,7 +7,7 @@ export interface Inputs {
|
|||
logout: string;
|
||||
}
|
||||
|
||||
export async function getInputs(): Promise<Inputs> {
|
||||
export function getInputs(): Inputs {
|
||||
return {
|
||||
registry: core.getInput('registry'),
|
||||
username: core.getInput('username'),
|
||||
|
|
13
src/main.ts
13
src/main.ts
|
@ -4,17 +4,16 @@ import {getInputs, Inputs} from './context';
|
|||
import * as docker from './docker';
|
||||
import * as stateHelper from './state-helper';
|
||||
|
||||
async function run(): Promise<void> {
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
if (os.platform() !== 'linux') {
|
||||
core.setFailed('Only supported on linux platform');
|
||||
return;
|
||||
throw new Error('Only supported on linux platform');
|
||||
}
|
||||
|
||||
let inputs: Inputs = await getInputs();
|
||||
stateHelper.setRegistry(inputs.registry);
|
||||
stateHelper.setLogout(inputs.logout);
|
||||
await docker.login(inputs.registry, inputs.username, inputs.password);
|
||||
const {registry, username, password, logout} = getInputs();
|
||||
stateHelper.setRegistry(registry);
|
||||
stateHelper.setLogout(logout);
|
||||
await docker.login(registry, username, password);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue