ci: standardize workflows and updater tag handling#1
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the GitHub updater to handle version tags prefixed with 'v' or 'V', corrects the repository slug casing, and adds a User-Agent header to API requests. Feedback focuses on hardening the code against missing tag_name properties in the GitHub API response to prevent PHP 8.1+ warnings when calling ltrim.
| if ( $remote && version_compare( $local_data['Version'], ltrim( $remote->tag_name, 'vV' ), '<' ) ) { | ||
| $obj = new stdClass(); | ||
| $obj->slug = dirname( $this->plugin_slug ); | ||
| $obj->new_version = $remote->tag_name; | ||
| $obj->new_version = ltrim( $remote->tag_name, 'vV' ); |
There was a problem hiding this comment.
The GitHub API may return an error response (e.g., due to rate limiting or a missing repository) as a valid JSON object that lacks the tag_name property. Accessing $remote->tag_name without verification will trigger a PHP warning in PHP 8.1+, where passing null to ltrim is deprecated. It is safer to verify the property exists before processing. Additionally, normalizing the version string once in a variable improves code clarity.
if ( $remote && isset( $remote->tag_name ) && version_compare( $local_data['Version'], $new_version = ltrim( $remote->tag_name, 'vV' ), '<' ) ) {
$obj = new stdClass();
$obj->slug = dirname( $this->plugin_slug );
$obj->new_version = $new_version;| $res->name = $local_data['Name']; | ||
| $res->slug = $plugin_dirname; | ||
| $res->version = $remote->tag_name; | ||
| $res->version = ltrim( $remote->tag_name, 'vV' ); |
There was a problem hiding this comment.
Summary
PHP Qualityworkflow (blocking php lint + non-blocking PHPCS report)Release Plugin ZIPworkflow for tag-based releases (v*)vprefixYisus-Develop/EWEB-Gallery-SuiteWhy
This keeps the plugin aligned with the EWEB release/update standard and avoids update version mismatches when releases use tags like
v1.4.3.Validation
php -lpassed for all PHP filesmainNotes