Skip to content

GH Actions/verify release: tweak the workflow #1092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2025

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented May 11, 2025

Description

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.

GH Actions/verify release: tweak the workflow [2]

PHIVE does not support a "stability" flag yet, which means that it will always grab the very latest release, even when this is an alpha/beta/RC pre-release.

As the GH API releases/latest route returns the latest stable release, this causes the workflow to fail.
This was already previously identified as an area which needed attention in #758, and as we now have a pre-release as the latest release (4.0.0beta1), this now needs to be fixed.

Note: this still doesn't fix things completely, as in reality, the workflow should work based on the tag published if the workflow is triggered by a release to ensure that the "release assets" and "versioned web" jobs check the right release ("unversioned web" should still always check the latest stable release), but it is unclear where to grab that info from and as testing the info available when the workflow is triggered by a release requires doing a release, this is neigh impossible to test. I may need to create a dummy repo just to test.

For now, this at least fixes the Phive jobs.

Suggested changelog entry

N/A

jrfnl added 2 commits May 11, 2025 12:30
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.
PHIVE does not support a "stability" flag yet, which means that it will always grab the very latest release, even when this is an alpha/beta/RC pre-release.

As the GH API `releases/latest` route returns the latest _stable_ release, this causes the workflow to fail.
This was already previously identified as an area which needed attention in #758, and as we now have a pre-release as the latest release (`4.0.0beta1`), this now needs to be fixed.

Note: this still doesn't fix things completely, as in reality, the workflow should work based on the tag published if the workflow is triggered by a release to ensure that the "release assets" and "versioned web" jobs check the right release ("unversioned web" should still always check the latest stable release), but it is unclear where to grab that info from and as testing the info available when the workflow is triggered by a release requires doing a release, this is neigh impossible to test. I may need to create a dummy repo just to test.

For now, this at least fixes the Phive jobs.
@jrfnl jrfnl added this to the 3.13.1 milestone May 11, 2025
@jrfnl jrfnl merged commit 6f9d29e into master May 11, 2025
81 checks passed
@jrfnl jrfnl deleted the feature/ghactions-tweak-release-check branch May 11, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant