Skip to content

Commit 2bdcdfe

Browse files
committed
Improve bash code style
1 parent 81e0392 commit 2bdcdfe

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

.github/workflows/unset-environment-new-cli.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,34 +55,40 @@ jobs:
5555
TEST_MODE: true
5656
- shell: bash
5757
run: |
58-
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
59-
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
60-
echo "Did not create a database for CPP, or created it in the wrong location."
58+
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
59+
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
60+
echo "Did not create a database for CPP, or created it in the wrong location." \
61+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CPP_DB }'"
6162
exit 1
6263
fi
63-
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
64-
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
65-
echo "Did not create a database for C Sharp, or created it in the wrong location."
64+
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
65+
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
66+
echo "Did not create a database for C Sharp, or created it in the wrong location." \
67+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CSHARP_DB }'"
6668
exit 1
6769
fi
68-
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
69-
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
70-
echo "Did not create a database for Go, or created it in the wrong location."
70+
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
71+
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${{ runner.temp }}/customDbLocation/*"" ]]; then
72+
echo "Did not create a database for Go, or created it in the wrong location." \
73+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ GO_DB }'"
7174
exit 1
7275
fi
73-
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
74-
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
75-
echo "Did not create a database for Java, or created it in the wrong location."
76+
JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}"
77+
if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
78+
echo "Did not create a database for Java, or created it in the wrong location." \
79+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVA_DB }'"
7680
exit 1
7781
fi
78-
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
79-
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
80-
echo "Did not create a database for Javascript, or created it in the wrong location."
82+
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
83+
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
84+
echo "Did not create a database for Javascript, or created it in the wrong location." \
85+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVASCRIPT_DB }'"
8186
exit 1
8287
fi
83-
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
84-
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
85-
echo "Did not create a database for Python, or created it in the wrong location."
88+
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
89+
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
90+
echo "Did not create a database for Python, or created it in the wrong location." \
91+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ PYTHON_DB }'"
8692
exit 1
8793
fi
8894
env:

.github/workflows/unset-environment-old-cli.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,34 @@ jobs:
5555
TEST_MODE: true
5656
- shell: bash
5757
run: |
58-
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
59-
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
60-
echo "Did not create a database for CPP, or created it in the wrong location."
58+
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
59+
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
60+
echo "Did not create a database for CPP, or created it in the wrong location." \
61+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CPP_DB }'"
6162
exit 1
6263
fi
63-
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
64-
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
65-
echo "Did not create a database for C Sharp, or created it in the wrong location."
64+
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
65+
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
66+
echo "Did not create a database for C Sharp, or created it in the wrong location." \
67+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CSHARP_DB }'"
6668
exit 1
6769
fi
68-
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
69-
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
70-
echo "Did not create a database for Go, or created it in the wrong location."
70+
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
71+
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
72+
echo "Did not create a database for Go, or created it in the wrong location." \
73+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ GO_DB }'"
7174
exit 1
7275
fi
73-
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
74-
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
75-
echo "Did not create a database for Javascript, or created it in the wrong location."
76+
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
77+
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
78+
echo "Did not create a database for Javascript, or created it in the wrong location." \
79+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVASCRIPT_DB }'"
7680
exit 1
7781
fi
78-
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
79-
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
80-
echo "Did not create a database for Python, or created it in the wrong location."
82+
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
83+
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then
84+
echo "Did not create a database for Python, or created it in the wrong location." \
85+
"Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ PYTHON_DB }'"
8186
exit 1
8287
fi
8388
env:

0 commit comments

Comments
 (0)