Skip to content

Commit 0a3fec8

Browse files
committed
Improve environment variables in unset environment PR check
1 parent 322cea6 commit 0a3fec8

File tree

2 files changed

+39
-36
lines changed

2 files changed

+39
-36
lines changed

.github/workflows/__unset-environment.yml

+20-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/unset-environment.yml

+19-18
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,41 @@ steps:
1616
with:
1717
upload-database: false
1818
- shell: bash
19+
env:
20+
CPP_DB: ${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
21+
CSHARP_DB: ${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
22+
GO_DB: ${{ fromJson(steps.analysis.outputs.db-locations).go }}
23+
JAVA_DB: ${{ fromJson(steps.analysis.outputs.db-locations).java }}
24+
JAVASCRIPT_DB: ${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
25+
PYTHON_DB: ${{ fromJson(steps.analysis.outputs.db-locations).python }}
1926
run: |
20-
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
21-
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then
27+
if [[ ! -d "$CPP_DB" ]] || [[ "$CPP_DB" != "$RUNNER_TEMP/customDbLocation/cpp" ]]; then
2228
echo "::error::Did not create a database for CPP, or created it in the wrong location." \
23-
"Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'"
29+
"Expected location was '$RUNNER_TEMP/customDbLocation/cpp' but actual was '${CPP_DB}'"
2430
exit 1
2531
fi
26-
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
27-
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then
32+
if [[ ! -d "$CSHARP_DB" ]] || [[ "$CSHARP_DB" != "$RUNNER_TEMP/customDbLocation/csharp" ]]; then
2833
echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \
29-
"Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'"
34+
"Expected location was '$RUNNER_TEMP/customDbLocation/csharp' but actual was '${CSHARP_DB}'"
3035
exit 1
3136
fi
32-
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
33-
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then
37+
if [[ ! -d "$GO_DB" ]] || [[ "$GO_DB" != "$RUNNER_TEMP/customDbLocation/go" ]]; then
3438
echo "::error::Did not create a database for Go, or created it in the wrong location." \
35-
"Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'"
39+
"Expected location was '$RUNNER_TEMP/customDbLocation/go' but actual was '${GO_DB}'"
3640
exit 1
3741
fi
38-
JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}"
39-
if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then
42+
if [[ ! -d "$JAVA_DB" ]] || [[ "$JAVA_DB" != "$RUNNER_TEMP/customDbLocation/java" ]]; then
4043
echo "::error::Did not create a database for Java, or created it in the wrong location." \
41-
"Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'"
44+
"Expected location was '$RUNNER_TEMP/customDbLocation/java' but actual was '${JAVA_DB}'"
4245
exit 1
4346
fi
44-
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
45-
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then
47+
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ "$JAVASCRIPT_DB" != "$RUNNER_TEMP/customDbLocation/javascript" ]]; then
4648
echo "::error::Did not create a database for Javascript, or created it in the wrong location." \
47-
"Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'"
49+
"Expected location was '$RUNNER_TEMP/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'"
4850
exit 1
4951
fi
50-
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
51-
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then
52+
if [[ ! -d "$PYTHON_DB" ]] || [[ "$PYTHON_DB" != "$RUNNER_TEMP/customDbLocation/python" ]]; then
5253
echo "::error::Did not create a database for Python, or created it in the wrong location." \
53-
"Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'"
54+
"Expected location was '$RUNNER_TEMP/customDbLocation/python' but actual was '${PYTHON_DB}'"
5455
exit 1
5556
fi

0 commit comments

Comments
 (0)