Skip to content

Reusable workflow#53

Merged
berfinyuksel merged 1 commit into2.2from
reusable_static_analysis
Mar 20, 2026
Merged

Reusable workflow#53
berfinyuksel merged 1 commit into2.2from
reusable_static_analysis

Conversation

@bluvulture
Copy link
Contributor

This pull request updates the static analysis GitHub Actions workflow to improve matrix handling and workflow execution. The main changes focus on how PHP version matrices are parsed and passed to the reusable workflow, as well as updating the workflow to use a unified static analysis workflow file. Additional secrets and options have also been added for improved CI configuration.

Workflow matrix and execution improvements:

  • Updated the matrix setup to output phpstan_matrix instead of the previous matrix, and changed the filtering logic to better handle PHP version selection and matrix inclusion (.github/workflows/static-analysis.yaml). [1] [2]
  • Switched the static analysis job to use the reusable-static-analysis-unified.yaml workflow instead of the older reusable-static-analysis-centralized.yaml, and updated the inputs to match the new matrix structure (.github/workflows/static-analysis.yaml).

Concurrency and CI configuration:

  • Added a concurrency group to the workflow to prevent overlapping runs for the same branch or PR, ensuring that only the latest run is active (.github/workflows/static-analysis.yaml).
  • Included new secrets and environment variables for enhanced CI instance identification and configuration (.github/workflows/static-analysis.yaml).
  • Set additional static analysis options such as REQUIRE_ADMIN_BUNDLE and COVERAGE to further control analysis behavior (.github/workflows/static-analysis.yaml).

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2026

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the repository’s static analysis GitHub Actions workflow to use a unified reusable workflow and to pass a precomputed PHPStan matrix via job outputs, while also adding workflow-level concurrency to avoid overlapping runs.

Changes:

  • Add workflow-level concurrency to cancel in-progress runs for the same branch/PR.
  • Rename and reshape the matrix output to phpstan_matrix (JSON { include: [...] }) and pass it into the reusable workflow.
  • Switch from reusable-static-analysis-centralized.yaml to reusable-static-analysis-unified.yaml and add new CI-related secrets/options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 45 to +50
if [ -f composer.json ]; then
php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//')
if [ -z "$php_versions" ]; then
echo "No PHP versions found in composer.json"
echo "Setting default PHP value"
echo "php_versions=default" >> $GITHUB_OUTPUT
echo "php_versions=default" >> "$GITHUB_OUTPUT"
else
echo "php_versions=$php_versions" >> $GITHUB_OUTPUT
echo "#### php versions #### : $php_versions"
echo "php_versions=$php_versions" >> "$GITHUB_OUTPUT"
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The PHP version parsing regex (grep -oP '\d+\.\d+') will incorrectly extract patch parts as separate versions for constraints like this repo’s "php": "~8.3.0 || ~8.4.0" (it yields 8.3,3.0,8.4,4.0). This will likely produce an invalid/empty matrix selection downstream. Consider extracting full major.minor.patch tokens first (e.g., \d+\.\d+\.\d+) and then normalizing to major.minor, or otherwise parsing Composer constraints more robustly.

Copilot uses AI. Check for mistakes.
echo "#### php versions #### : $php_versions"
echo "php_versions=$php_versions" >> "$GITHUB_OUTPUT"
fi
else
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

When composer.json is missing, the step exits with status 1 but prints no error message. Adding a short message to stderr before exiting would make failures easier to diagnose in CI logs.

Suggested change
else
else
echo "Error: composer.json not found; cannot parse PHP versions." >&2

Copilot uses AI. Check for mistakes.
@berfinyuksel berfinyuksel merged commit c678022 into 2.2 Mar 20, 2026
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants