Skip to content

Commit

Permalink
fix: 🐛 Properly set default config for usage as node module
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Sep 2, 2024
1 parent 361d3f0 commit fa0c379
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions src/lib.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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<void> {
let status: Status = Status.RUNNING

Expand Down Expand Up @@ -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)

Check failure on line 56 in src/lib.ts

View workflow job for this annotation

GitHub Actions / build

'configuration' is possibly 'undefined'.
Expand Down
4 changes: 1 addition & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {action} from './constants'
import run from './lib'

// Runs the action within the GitHub actions environment.
run(action)
run()

0 comments on commit fa0c379

Please sign in to comment.