Modify action.yml

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-03-31 23:54:57 +05:30
parent 6c4ab503eb
commit 005af2ac0e
8 changed files with 23 additions and 27 deletions

View file

@ -24,4 +24,4 @@ jobs:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
logout: true
logout: false

View file

@ -10,14 +10,14 @@ inputs:
required: true
username:
description: 'Username to login against the container image registry'
required: false
required: true
password:
description: 'Password to login against the container image registry'
required: false
description: 'Password or token to login against the container image registry'
required: true
logout:
description: 'Set to true if you want to logout at the end of the job'
description: 'Set to false if you do not want to logout at the end of the job'
required: false
default: 'false'
default: 'true'
runs:
using: 'node12'

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -13,6 +13,6 @@ export function getInputs(): ActionInputs {
registry: core.getInput(Inputs.REGISTRY),
username: core.getInput(Inputs.USERNAME),
password: core.getInput(Inputs.PASSWORD),
logout: core.getInput(Inputs.LOGOUT),
logout: core.getInput(Inputs.LOGOUT) || "true",
};
}

View file

@ -1,14 +1,14 @@
// This file was auto-generated by action-io-generator. Do not edit by hand!
export enum Inputs {
/**
* Set to true if you want to logout at the end of the job
* Set to false if you do not want to logout at the end of the job
* Required: false
* Default: "false"
* Default: "true"
*/
LOGOUT = "logout",
/**
* Password to login against the container image registry
* Required: false
* Password or token to login against the container image registry
* Required: true
* Default: None.
*/
PASSWORD = "password",
@ -20,7 +20,7 @@ export enum Inputs {
REGISTRY = "registry",
/**
* Username to login against the container image registry
* Required: false
* Required: true
* Default: None.
*/
USERNAME = "username",

View file

@ -46,7 +46,7 @@ async function run(): Promise<void> {
core.info(`✅ Successfully logged in to ${registry}`);
}
async function logout(): Promise<void> {
async function registryLogout(): Promise<void> {
if (!stateHelper.logout) {
return;
}
@ -57,5 +57,5 @@ if (!stateHelper.IsPost) {
run().catch(core.setFailed);
}
else {
logout().catch(core.setFailed);
registryLogout().catch(core.setFailed);
}

View file

@ -1,19 +1,15 @@
import * as core from "@actions/core";
/* eslint-disable dot-notation */
export const IsPost = !!process.env["STATE_isPost"];
export const registry = process.env["STATE_registry"] || "";
export const logout = /true/i.test(process.env["STATE_logout"] || "");
/* eslint-enable dot-notation */
export const IsPost = !!process.env.STATE_isPost;
export const registry = process.env.STATE_registry || "";
export const logout = /true/i.test(process.env.STATE_logout || "");
// eslint-disable-next-line @typescript-eslint/no-shadow
export function setRegistry(registry: string): void {
core.saveState("registry", registry);
export function setRegistry(inputRegistry: string): void {
core.saveState("registry", inputRegistry);
}
// eslint-disable-next-line @typescript-eslint/no-shadow
export function setLogout(logout: string): void {
core.saveState("logout", logout);
export function setLogout(registryLogout: string): void {
core.saveState("logout", registryLogout);
}
if (!IsPost) {