Skip to content

Commit

Permalink
Merge pull request #630 from PHPCSStandards/feature/ghactions-quote-vars
Browse files Browse the repository at this point in the history
GH Actions: always quote variables
  • Loading branch information
jrfnl authored Oct 13, 2024
2 parents b3d58ca + 49ae729 commit 48d0151
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
id: set_ini
run: |
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
else
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
fi
- name: Install PHP
Expand Down Expand Up @@ -87,20 +87,20 @@ jobs:
- name: Grab PHPUnit version
id: phpunit_version
# yamllint disable-line rule:line-length
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"

- name: Determine PHPUnit config file to use
id: phpunit_config
run: |
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
else
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
echo 'EXTRA_ARGS= --repeat 2' >> "$GITHUB_OUTPUT"
fi
- name: Run the unit tests without caching
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ jobs:
id: set_ini
run: |
if [[ "${{ matrix.phpcs_version }}" != "dev-master" && "${{ matrix.phpcs_version }}" != "4.0.x-dev" ]]; then
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
else
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
fi
- name: Install PHP
Expand Down Expand Up @@ -208,20 +208,20 @@ jobs:
- name: Grab PHPUnit version
id: phpunit_version
# yamllint disable-line rule:line-length
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"

- name: Determine PHPUnit config file to use
id: phpunit_config
run: |
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
else
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
echo 'EXTRA_ARGS= --repeat 2' >> "$GITHUB_OUTPUT"
fi
- name: Run the unit tests without caching (non-risky)
Expand Down Expand Up @@ -295,9 +295,9 @@ jobs:
id: set_ini
run: |
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
else
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
fi
- name: Install PHP
Expand Down Expand Up @@ -332,7 +332,7 @@ jobs:
- name: Grab PHPUnit version
id: phpunit_version
# yamllint disable-line rule:line-length
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"

- name: "DEBUG: Show grabbed version"
run: echo ${{ steps.phpunit_version.outputs.VERSION }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
REF: ${{ github.ref }}
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "BRANCH=$REF" >> $GITHUB_OUTPUT
echo "BRANCH=$REF" >> "$GITHUB_OUTPUT"
else
echo 'BRANCH=${{ env.DEFAULT_BRANCH }}' >> $GITHUB_OUTPUT
echo 'BRANCH=${{ env.DEFAULT_BRANCH }}' >> "$GITHUB_OUTPUT"
fi
- name: Checkout code
Expand Down Expand Up @@ -86,9 +86,9 @@ jobs:
# yamllint disable rule:line-length
run: |
if [[ "${{ github.event_name }}" == 'release' && "${{ github.ref_type }}" == 'published' && "$REF_NAME" == "${{ env.DEFAULT_BRANCH }}" ]]; then
echo "LAST_TAG=$REF_NAME" >> $GITHUB_OUTPUT
echo "LAST_TAG=$REF_NAME" >> "$GITHUB_OUTPUT"
else # = Pushed tag.
echo "LAST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
echo "LAST_TAG=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"
fi
# yamllint enable rule:line-length

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update-phpcs-versionnr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ jobs:
- name: Grab latest tag name from API response
id: version
run: |
echo "TAG=${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}" >> $GITHUB_OUTPUT
echo "TAG=${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}" >> "$GITHUB_OUTPUT"
- name: Show tag name found in API response
run: "echo latest release: ${{ steps.version.outputs.TAG }}"

- name: Set branches to use
id: branches
run: |
echo "BASE=develop" >> $GITHUB_OUTPUT
echo "PR_BRANCH=feature/getversiontest-update-phpcs-version" >> $GITHUB_OUTPUT
echo "BASE=develop" >> "$GITHUB_OUTPUT"
echo "PR_BRANCH=feature/getversiontest-update-phpcs-version" >> "$GITHUB_OUTPUT"
- name: Checkout code
uses: actions/checkout@v4
Expand Down

0 comments on commit 48d0151

Please sign in to comment.