Skip to content

Commit e51979b

Browse files
committed
fix: option for agent, cleanup steps
Signed-off-by: Sam Gammon <[email protected]>
1 parent 89c51f9 commit e51979b

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

dist/cleanup/index.js

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export function buildEffectiveOptions(options?: Partial<Options>): Options {
108108
arch: normalizeArch(
109109
stringOption(OptionName.ARCH, process.arch) as string
110110
),
111+
agent: booleanOption(OptionName.AGENT, true),
111112
export_path: booleanOption(OptionName.EXPORT_PATH, true),
112113
token: stringOption(OptionName.TOKEN, process.env.GITHUB_TOKEN),
113114
custom_url: stringOption(OptionName.CUSTOM_URL)
@@ -260,6 +261,7 @@ export async function install(options?: Partial<Options>): Promise<void> {
260261
}
261262

262263
// mount outputs
264+
core.saveState('buildlessBinpath', outputs.path)
263265
core.setOutput(ActionOutputName.PATH, outputs.path)
264266
core.setOutput(ActionOutputName.VERSION, version)
265267
core.info(`Buildless installed at version ${release.version.tag_name} 🎉`)
@@ -283,7 +285,8 @@ export async function postExecute(options?: Partial<Options>): Promise<void> {
283285
core.info(`Cleaning up Buildless Agent and resources...`)
284286
const agentPid = core.getState('agentPid')
285287
const activeAgent = await agentConfig(targetOs)
286-
if (activeAgent) {
288+
if (agentPid) {
289+
setBinpath(core.getState('buildlessBinpath'))
287290
let errMessage = 'unknown'
288291
try {
289292
await agentStop()
@@ -293,7 +296,7 @@ export async function postExecute(options?: Partial<Options>): Promise<void> {
293296
)
294297
let killFailed = false
295298
try {
296-
process.kill(activeAgent.pid)
299+
process.kill(activeAgent?.pid || parseInt(agentPid, 10))
297300
} catch (err) {
298301
killFailed = true
299302
if (err instanceof Error) {

0 commit comments

Comments
 (0)