Skip to content

Commit 5d04094

Browse files
committed
Correcting ifelse statement and adding check
1 parent f5f9215 commit 5d04094

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/workflows/test-twostep-container-build.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ jobs:
6868
push-image-1: false
6969
push-image-2: false
7070

71+
- name: Check the output
72+
run: |
73+
if [ "${{ steps.twostep-1.outputs.summary }}" != "cached" ]; then
74+
echo "Using the cached version (OK)"
75+
else
76+
echo "This was supposed to use the cache version"
77+
exit 1
78+
fi
79+
7180
# This job is used to test the action with arguments.
7281
# Caching should also be triggered here.
7382
test-with-args:
@@ -104,4 +113,13 @@ jobs:
104113
run: |
105114
docker inspect ghcr.io/cdcgov/cfa-actions-with-args:${{ steps.twostep-2.outputs.tag }} \
106115
--format='{{json .Config.Labels}}' | jq .
107-
116+
117+
- name: Check the output
118+
run: |
119+
if [ "${{ steps.twostep-2.outputs.summary }}" != "cached" ]; then
120+
echo "Using the cached version (OK)"
121+
else
122+
echo "This was supposed to use the cache version"
123+
exit 1
124+
fi
125+

twostep-container-build/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ runs:
208208
# - The image existed, and the cache matched, so we did not rebuild it
209209
if [ "${{ steps.cache.outputs.cache-hit }}" == "" ]; then
210210
echo "result=built" >> $GITHUB_OUTPUT
211-
else if [ "${{ steps.cache.outputs.cache-hit }}" == "false" ]; then
211+
elif [ "${{ steps.cache.outputs.cache-hit }}" == "false" ]; then
212212
echo "result=rebuilt" >> $GITHUB_OUTPUT
213213
else
214214
echo "result=cached" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)