mirror of
https://hub.psychoinformatics.de/actions/checkout-action.git
synced 2026-09-10 13:56:03 +00:00
25 lines
807 B
PowerShell
25 lines
807 B
PowerShell
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
|
|
# Test script used by tools/ci/test-bash-func.sh.
|
|
|
|
Set-StrictMode -Version Latest
|
|
|
|
$prev_err_action = $ErrorActionPreference
|
|
$ErrorActionPreference = "Continue"
|
|
& bash -c "/usr/bin/env | grep -F '=() {'"
|
|
$code = $LASTEXITCODE
|
|
$ErrorActionPreference = "$prev_err_action"
|
|
if ($code -ne 0) { exit 1 }
|
|
|
|
# NB: Sync with action.yml
|
|
(Get-ChildItem Env:*) | ForEach-Object {
|
|
# -LiteralPath is important since BASH_FUNC_[%% is valid environment variable to override [.
|
|
if ($_.Value.StartsWith("() {")) { Remove-Item -LiteralPath "Env:\$($_.Key)" }
|
|
}
|
|
|
|
$prev_err_action = $ErrorActionPreference
|
|
$ErrorActionPreference = "Continue"
|
|
& bash -c "/usr/bin/env | grep -F '=() {'"
|
|
$code = $LASTEXITCODE
|
|
$ErrorActionPreference = "$prev_err_action"
|
|
if ($code -ne 1) { exit 1 }
|