Skip to content

ci: standardize workflows and updater tag handling#1

Open
Yisus-Develop wants to merge 1 commit into
mainfrom
codex/standardize-eweb-gallery-suite
Open

ci: standardize workflows and updater tag handling#1
Yisus-Develop wants to merge 1 commit into
mainfrom
codex/standardize-eweb-gallery-suite

Conversation

@Yisus-Develop

Copy link
Copy Markdown
Owner

Summary

  • add PHP Quality workflow (blocking php lint + non-blocking PHPCS report)
  • add Release Plugin ZIP workflow for tag-based releases (v*)
  • normalize updater version handling for GitHub tags with v prefix
  • add GitHub API User-Agent header for updater request stability
  • align updater repo reference to Yisus-Develop/EWEB-Gallery-Suite

Why

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

  • local php -l passed for all PHP files
  • branch pushed without modifying main

Notes

  • no functional feature changes in gallery behavior
  • only CI/release/update pipeline hardening

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +67 to +70
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' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To prevent PHP warnings when the GitHub API response is unexpected or missing the tag_name property, use the null coalescing operator to provide a safe fallback for the ltrim function. This ensures compatibility with PHP 8.1+.

			$res->version = ltrim( $remote->tag_name ?? '', 'vV' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant