mirror of
https://github.com/docker/login-action.git
synced 2025-06-24 03:57:58 +02:00
Mostly tests and some small changes (#16)
* Create docker.test.ts * Add context tests * test main
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user