Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ljtill committed Jun 27, 2024
1 parent 4e1fb90 commit aa2a78a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
16 changes: 10 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ function getInput(
return value
}

function setCommonInputs(config: Config) {
config.inputs.name = getInput('name', true)
config.inputs.location = getInput('location', false)
config.inputs.mode = getInput('mode', true, ['create', 'delete', 'validate'])
config.inputs.wait = getInput('wait', false) === 'true'
}

function setModeInputs(config: Config) {
if (config.inputs.mode === 'create' || config.inputs.mode === 'validate') {
config.inputs.description = getInput('description', false)
Expand Down Expand Up @@ -65,6 +72,10 @@ function setModeInputs(config: Config) {
config.context.repository = `${github.context.repo.owner}/${github.context.repo.repo}`
config.context.commit = github.context.sha
config.context.branch = github.context.ref

// Bypass stack out of sync error
config.inputs.bypassStackOutOfSyncError =
getInput('bypassStackOutOfSyncError', false) === 'true'
}
}

Expand Down Expand Up @@ -95,17 +106,10 @@ function setScopeInputs(config: Config) {
export function newConfig(): Config {
const config: Config = createDefaultConfig()

config.inputs.name = getInput('name', true)
config.inputs.location = getInput('location', false)
config.inputs.mode = getInput('mode', true, ['create', 'delete', 'validate'])

setCommonInputs(config)
setModeInputs(config)
setScopeInputs(config)

config.inputs.bypassStackOutOfSyncError =
getInput('bypassStackOutOfSyncError', false) === 'true'
config.inputs.wait = getInput('wait', false) === 'true'

core.debug(`Configuration: ${JSON.stringify(config)}`)

return config
Expand Down

0 comments on commit aa2a78a

Please sign in to comment.