Skip to content

Commit

Permalink
- Updated to handle when ran locally vs when run in the action
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Silcott committed Dec 10, 2024
1 parent 903a922 commit 7145692
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27590,8 +27590,14 @@ function chooseBinary() {
return `action-linux-arm64`
}
}

let pathToBinaries = "."
if (__filename == "invoke-binary.js") {
pathToBinaries = `${__dirname}/dist`
}

const binary = chooseBinary()
const mainScript = `${__dirname}/dist/${binary} validate --token="${core.getInput('token')}" --self="${core.getInput('self')}" --interval="${core.getInput('interval')}" --ref="${core.getInput('ref')}" --timeout="${core.getInput('timeout')}" --ignored="${core.getInput('ignored')}"`
const mainScript = `${pathToBinaries}/${binary} validate --token="${core.getInput('token')}" --self="${core.getInput('self')}" --interval="${core.getInput('interval')}" --ref="${core.getInput('ref')}" --timeout="${core.getInput('timeout')}" --ignored="${core.getInput('ignored')}"`
const spawnSyncReturns = childProcess.spawnSync(mainScript, {
stdio: 'inherit',
shell: true,
Expand Down
11 changes: 9 additions & 2 deletions invoke-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ function chooseBinary() {
core.notice("Linux ARM64 binary selected")
return `action-linux-arm64`
}
}
}

let pathToBinaries = "."
if (__filename.split("/").pop() === "invoke-binary.js") {
core.notice("Running invoke-binary.js")
pathToBinaries = `${__dirname}/dist`
}

const binary = chooseBinary()
const mainScript = `${__dirname}/dist/${binary} validate --token="${core.getInput('token')}" --self="${core.getInput('self')}" --interval="${core.getInput('interval')}" --ref="${core.getInput('ref')}" --timeout="${core.getInput('timeout')}" --ignored="${core.getInput('ignored')}"`
const mainScript = `${pathToBinaries}/${binary} validate --token="${core.getInput('token')}" --self="${core.getInput('self')}" --interval="${core.getInput('interval')}" --ref="${core.getInput('ref')}" --timeout="${core.getInput('timeout')}" --ignored="${core.getInput('ignored')}"`
const spawnSyncReturns = childProcess.spawnSync(mainScript, {
stdio: 'inherit',
shell: true,
Expand Down

0 comments on commit 7145692

Please sign in to comment.