Skip to content

Commit 6b81fa7

Browse files
authored
GH Actions: always quote variables (#364)
... to satisfy shellcheck rule SC2086: "Double quote to prevent globbing and word splitting". Ref: https://www.shellcheck.net/wiki/SC2086 Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
1 parent 65f39fc commit 6b81fa7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ jobs:
109109
# On stable PHPCS versions, allow for PHP deprecation notices.
110110
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
111111
if [ "${{ matrix.phpcs_version }}" != "4.x-dev" ]; then
112-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
112+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On, zend.assertions=1' >> "$GITHUB_OUTPUT"
113113
else
114-
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
114+
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1' >> "$GITHUB_OUTPUT"
115115
fi
116116
117117
- name: Install PHP
@@ -140,15 +140,15 @@ jobs:
140140

141141
- name: Grab PHPUnit version
142142
id: phpunit_version
143-
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
143+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
144144

145145
- name: Determine PHPUnit config file to use
146146
id: phpunit_config
147147
run: |
148148
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) || startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
149-
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
149+
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
150150
else
151-
echo 'FILE=phpunitlte9.xml.dist' >> $GITHUB_OUTPUT
151+
echo 'FILE=phpunitlte9.xml.dist' >> "$GITHUB_OUTPUT"
152152
fi
153153
154154
- name: Run the unit tests
@@ -187,9 +187,9 @@ jobs:
187187
# On stable PHPCS versions, allow for PHP deprecation notices.
188188
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
189189
if [ "${{ matrix.phpcs_version }}" != "4.x-dev" ]; then
190-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
190+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On, zend.assertions=1' >> "$GITHUB_OUTPUT"
191191
else
192-
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
192+
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1' >> "$GITHUB_OUTPUT"
193193
fi
194194
195195
- name: Install PHP
@@ -213,7 +213,7 @@ jobs:
213213

214214
- name: Grab PHPUnit version
215215
id: phpunit_version
216-
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
216+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
217217

218218
- name: "DEBUG: Show grabbed version"
219219
run: echo ${{ steps.phpunit_version.outputs.VERSION }}
@@ -222,14 +222,14 @@ jobs:
222222
id: phpunit_config
223223
run: |
224224
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '9.' ) && steps.phpunit_version.outputs.VERSION >= '9.3' }}" == "true" ]; then
225-
echo 'FILE=phpunitlte9.xml.dist' >> $GITHUB_OUTPUT
226-
echo 'EXTRA_ARGS=--coverage-cache ./build/phpunit-cache' >> $GITHUB_OUTPUT
225+
echo 'FILE=phpunitlte9.xml.dist' >> "$GITHUB_OUTPUT"
226+
echo 'EXTRA_ARGS=--coverage-cache ./build/phpunit-cache' >> "$GITHUB_OUTPUT"
227227
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) || startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
228-
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
229-
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
228+
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
229+
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
230230
else
231-
echo 'FILE=phpunitlte9.xml.dist' >> $GITHUB_OUTPUT
232-
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
231+
echo 'FILE=phpunitlte9.xml.dist' >> "$GITHUB_OUTPUT"
232+
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
233233
fi
234234
235235
# PHPUnit 9.3 started using PHP-Parser for code coverage which can cause interference.

0 commit comments

Comments
 (0)