Skip to content

Commit fa3d72b

Browse files
authored
test(library): add basic assertion for env context's tests (#1957)
This PR attempts to better capture the current current incorrect behavior for `Contexts.env`. Part of #1956.
1 parent 8005a2e commit fa3d72b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/workflows/end-to-end-tests.main.kts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,20 @@ workflow(
188188
env = mapOf(
189189
FIRST_NAME to "Patrick",
190190
),
191-
command = "echo $GREETING $FIRST_NAME",
191+
// The assertion below presents the current, undesired behavior related to
192+
// env vars, used either from shell or GitHub Actions expressions.
193+
// TODO: fix in https://github.com/typesafegithub/github-workflows-kt/issues/1956
194+
command = """
195+
cat << EOF > actual
196+
$GREETING-$FIRST_NAME
197+
EOF
198+
199+
cat << EOF > expected
200+
-
201+
EOF
202+
203+
diff actual expected
204+
""".trimIndent(),
192205
)
193206
run(
194207
name = "Encrypted secret",

.github/workflows/end-to-end-tests.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ jobs:
9999
name: 'Custom environment variable'
100100
env:
101101
$FIRST_NAME: 'Patrick'
102-
run: 'echo $GREETING $FIRST_NAME'
102+
run: |-
103+
cat << EOF > actual
104+
$GREETING-$FIRST_NAME
105+
EOF
106+
107+
cat << EOF > expected
108+
-
109+
EOF
110+
111+
diff actual expected
103112
- id: 'step-11'
104113
name: 'Encrypted secret'
105114
env:

0 commit comments

Comments
 (0)