Skip to content

Commit 45b7a3a

Browse files
committed
GH Actions/verify release: tweak the workflow [1]
As of PHPCS 4.0.0, a new "No files were checked" error will be shown if `phpcs`/`phpcbf` runs a scan and no files end up being scanned. Previously, to test that the downloaded PHAR file is nominally functional, the `php ${{ steps.source.outputs.FILE }} . -e --standard=PSR12` command was used. For `phpcs`, this would "explain" the PSR12 standard, for `phpcbf`, this would spin up PHPCS and end up not scanning anything as there are no files in the working directory, but it did test that the PHAR file was functional. This "trick" will no longer work with PHPCS 4.0.0 due to the new "No files were checked" error. As I'd prefer for this check to do a simple scan, rather than exit out while reading the CLI arguments (like would happen with the `-h` or `-i` flags), I'm now implementing the suggestion made by fredden in https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/758/files#diff-c871a3c5382d363c3ead11f0f87306fd5954b360eaa8a96fea8582bce1815827 and creating a simple PHP file to scan.
1 parent 72669d9 commit 45b7a3a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/verify-release.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
verify-available-downloads:
2828
runs-on: ubuntu-latest
2929

30-
# Only run this workflow in the context of this repo.
31-
if: github.repository_owner == 'PHPCSStandards'
30+
# Only run this workflow in the context of this repo.
31+
if: github.repository_owner == 'PHPCSStandards'
3232

3333
strategy:
3434
fail-fast: false
@@ -109,9 +109,11 @@ jobs:
109109
ini-values: error_reporting=-1, display_errors=On
110110
coverage: none
111111

112-
# Note: the `.` is in the command to make it work for both PHPCS as well PHPCBF.
112+
- name: Create a PHP file
113+
run: echo '<?php echo "Hello, World!";' > hello.php
114+
113115
- name: Verify the PHAR is nominally functional
114-
run: php ${{ steps.source.outputs.FILE }} . -e --standard=PSR12
116+
run: php ${{ steps.source.outputs.FILE }} -- -ps hello.php --standard=PSR2
115117

116118
- name: Grab the version
117119
id: asset_version
@@ -133,8 +135,8 @@ jobs:
133135
verify-phive:
134136
runs-on: ubuntu-latest
135137

136-
# Only run this workflow in the context of this repo.
137-
if: github.repository_owner == 'PHPCSStandards'
138+
# Only run this workflow in the context of this repo.
139+
if: github.repository_owner == 'PHPCSStandards'
138140

139141
strategy:
140142
fail-fast: false
@@ -186,9 +188,11 @@ jobs:
186188
GH_TOKEN: ${{ github.token }}
187189
GH_FORCE_TTY: true
188190

189-
# Note: the `.` is in the command to make it work for both PHPCS as well PHPCBF.
191+
- name: Create a PHP file
192+
run: echo '<?php echo "Hello, World!";' > hello.php
193+
190194
- name: Verify the PHAR is nominally functional
191-
run: php ./tools/${{ matrix.pharfile }} . -e --standard=PSR12
195+
run: php ./tools/${{ matrix.pharfile }} -- -ps hello.php --standard=PSR2
192196

193197
- name: Grab the version
194198
id: asset_version

0 commit comments

Comments
 (0)