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 }} username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }} password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }} registry: ${{ env.IMAGE_REGISTRY }}
logout: true logout: false

View file

@ -10,14 +10,14 @@ inputs:
required: true required: true
username: username:
description: 'Username to login against the container image registry' description: 'Username to login against the container image registry'
required: false required: true
password: password:
description: 'Password to login against the container image registry' description: 'Password or token to login against the container image registry'
required: false required: true
logout: 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 required: false
default: 'false' default: 'true'
runs: runs:
using: 'node12' 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), registry: core.getInput(Inputs.REGISTRY),
username: core.getInput(Inputs.USERNAME), username: core.getInput(Inputs.USERNAME),
password: core.getInput(Inputs.PASSWORD), 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! // This file was auto-generated by action-io-generator. Do not edit by hand!
export enum Inputs { 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 * Required: false
* Default: "false" * Default: "true"
*/ */
LOGOUT = "logout", LOGOUT = "logout",
/** /**
* Password to login against the container image registry * Password or token to login against the container image registry
* Required: false * Required: true
* Default: None. * Default: None.
*/ */
PASSWORD = "password", PASSWORD = "password",
@ -20,7 +20,7 @@ export enum Inputs {
REGISTRY = "registry", REGISTRY = "registry",
/** /**
* Username to login against the container image registry * Username to login against the container image registry
* Required: false * Required: true
* Default: None. * Default: None.
*/ */
USERNAME = "username", USERNAME = "username",

View file

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

View file

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