From fa0c379aacd98748b423933314fa3b83e1596f1f Mon Sep 17 00:00:00 2001 From: James Ives Date: Mon, 2 Sep 2024 11:22:34 -0400 Subject: [PATCH] fix: :bug: Properly set default config for usage as node module --- src/constants.ts | 4 +++- src/lib.ts | 10 +++++----- src/main.ts | 4 +--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 1d3298468..9308d061f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,7 +4,9 @@ import {isNullOrUndefined, stripProtocolFromUrl} from './util' const {pusher, repository} = github.context.payload -/* Flags to signal different scenarios to test cases */ +/* + * Flags to signal different scenarios to test cases + */ export enum TestFlag { NONE = 0, HAS_CHANGED_FILES = 1 << 1, // Assume changes to commit. diff --git a/src/lib.ts b/src/lib.ts index 1a6ea0da9..e2eab2339 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -1,5 +1,5 @@ import {exportVariable, info, notice, setFailed, setOutput} from '@actions/core' -import {ActionInterface, NodeActionInterface, Status} from './constants' +import {action, ActionInterface, NodeActionInterface, Status} from './constants' import {deploy, init} from './git' import {configureSSH} from './ssh' import { @@ -11,12 +11,11 @@ import { isNullOrUndefined } from './util' -/** Initializes and runs the action. - * - * @param {object} configuration - The action configuration. +/** + * Initializes and runs the action. */ export default async function run( - configuration: ActionInterface | NodeActionInterface + configuration?: ActionInterface | NodeActionInterface ): Promise { let status: Status = Status.RUNNING @@ -51,6 +50,7 @@ export default async function run( info('Checking configuration and starting deployment… 🚦') const settings: ActionInterface = { + ...action, ...configuration, // Set the default branch for Node configurations branch: !isNullOrUndefined(configuration.branch) diff --git a/src/main.ts b/src/main.ts index c641819db..029bc7e53 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,3 @@ -import {action} from './constants' import run from './lib' -// Runs the action within the GitHub actions environment. -run(action) +run()