Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Call removeEnvironmentFromAutoActivate in post setup #198

Merged
merged 13 commits into from
Feb 21, 2024
20 changes: 17 additions & 3 deletions src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as coreDefault from '@actions/core'
import { coreMocked } from './mocking'
import { getOptions, type Options } from './options'
import { determineEnvironmentName } from './util'
import { shellDeinit } from './shell-init'
import { removeEnvironmentFromAutoActivate, shellDeinit } from './shell-init'
import { saveCacheDownloads } from './cache'

const core = process.env.MOCKING ? coreMocked : coreDefault
Expand Down Expand Up @@ -74,13 +74,27 @@ const cleanup = (options: Options) => {
return Promise.all([
removeMicromambaRunShell(options),
...options.initShell.map((shell) => shellDeinit(options, shell))
]).then(() => undefined) // output is not used
])
.then(() => determineEnvironmentName(options.environmentName, options.environmentFile))
.then((environmentName) =>
Promise.all(
options.initShell.map((shell) => removeEnvironmentFromAutoActivate(options, environmentName, shell))
)
)
delsner marked this conversation as resolved.
Show resolved Hide resolved
.then(() => undefined) // output is not used
case 'environment':
return Promise.all([
uninstallEnvironment(options),
removeMicromambaRunShell(options),
...options.initShell.map((shell) => shellDeinit(options, shell))
]).then(() => undefined) // output is not used
])
.then(() => determineEnvironmentName(options.environmentName, options.environmentFile))
.then((environmentName) =>
Promise.all(
options.initShell.map((shell) => removeEnvironmentFromAutoActivate(options, environmentName, shell))
)
)
.then(() => undefined) // output is not used
case 'all':
return Promise.all(options.initShell.map((shell) => shellDeinit(options, shell)))
.then(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/shell-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const shellInit = (options: Options, shell: string) => {
return command.finally(core.endGroup)
}

export const shellDeinit = (options: Options, shell: string) => {
export const shellDeinit = (options: Options, shell: ShellType) => {
core.startGroup(`Deinitialize micromamba for ${shell}`)
const rootPrefixFlag = getRootPrefixFlagForInit(options)
const command = execute(
Expand Down