@@ -23,10 +23,16 @@ jobs:
23
23
with :
24
24
variables : |
25
25
URL=https://github.com
26
+ # Next step: verify that the variable has been saved in the ENV.
26
27
- run : |
27
- echo "Exported variable URL=$URL"
28
+ if [ -z "$URL" ]; then
29
+ echo "Error: github-action-store-variable lib did not save 'URL' to ENV as expected. The library is not working as intended."
30
+ exit 1
31
+ fi
32
+ echo "Exported variable URL is: $URL"
28
33
env:
29
34
URL: ${{ env.URL }}
35
+
30
36
run-integration-test2 :
31
37
runs-on : ubuntu-22.04
32
38
needs : run-integration-test1
@@ -41,12 +47,22 @@ jobs:
41
47
variables : |
42
48
URL
43
49
SECOND_URL=https://github.com/UnlyEd
50
+ # Next step: verify that both URL and SECOND_URL were propagated.
44
51
- run : |
45
- echo "Found from previous job URL=$URL"
46
- echo "Exported variable SECOND_URL=$SECOND_URL"
52
+ if [ -z "$URL" ]; then
53
+ echo "Error: github-action-store-variable lib did not propagate 'URL' to the environment as expected. The library is not working as intended."
54
+ exit 1
55
+ fi
56
+ if [ -z "$SECOND_URL" ]; then
57
+ echo "Error: github-action-store-variable lib did not save 'SECOND_URL' to ENV as expected. The library is not working as intended."
58
+ exit 1
59
+ fi
60
+ echo "Found from previous job, URL is: $URL"
61
+ echo "Exported variable SECOND_URL is: $SECOND_URL"
47
62
env:
48
63
URL: ${{ env.URL }}
49
64
SECOND_URL: ${{ env.SECOND_URL }}
65
+
50
66
run-integration-test3 :
51
67
runs-on : ubuntu-22.04
52
68
needs : run-integration-test2
61
77
variables : |
62
78
URL
63
79
SECOND_URL
80
+ # Next step: verify that URL and SECOND_URL are available.
64
81
- run : |
65
- echo "Found from previous job URL=$URL"
66
- echo "Found from previous job SECOND_URL=$SECOND_URL"
82
+ if [ -z "$URL" ]; then
83
+ echo "Error: github-action-store-variable lib did not propagate 'URL' to the environment as expected. The library is not working as intended."
84
+ exit 1
85
+ fi
86
+ if [ -z "$SECOND_URL" ]; then
87
+ echo "Error: github-action-store-variable lib did not propagate 'SECOND_URL' to the environment as expected. The library is not working as intended."
88
+ exit 1
89
+ fi
90
+ echo "Found from previous job, URL is: $URL"
91
+ echo "Found from previous job, SECOND_URL is: $SECOND_URL"
67
92
env:
68
93
URL: ${{ env.URL }}
69
94
SECOND_URL: ${{ env.SECOND_URL }}
80
105
with :
81
106
variables : |
82
107
UNKNOWN_VAR
83
- failIfNotFound : false # Default is false
108
+ failIfNotFound : false # Default is false, so missing UNKNOWN_VAR is allowed.
0 commit comments