Skip to content

Reduce GitHub Actions cost in CI workflows - #176

Merged
sorinmarta merged 1 commit into
masterfrom
ci/reduce-actions-cost
Nov 9, 2026
Merged

sorinmarta merged 1 commit into
masterfrom
ci/reduce-actions-cost

Conversation

@sorinmarta

Copy link
Copy Markdown
Contributor

Reduces GitHub Actions cost in the CI workflows. Adapted from https://github.com/Strategy11/business-directory-stripe/issues/74.

Changes

All three workflows (phpcs.yml, phpstan.yml, phpunit.yml)

  • Added workflow-level concurrency (group ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}, cancel-in-progress: true), so rapid pushes to a labelled PR cancel the stale run instead of stacking full runs.
  • The existing label if: gates on the jobs are unchanged.

phpcs.yml

  • Caches the global Composer cache dir before composer global require for WPCS. Key: ${{ runner.os }}-composer-phpcs-${{ hashFiles('.github/workflows/phpcs.yml') }}.

phpstan.yml

  • Caches the Composer cache dir after setup-php, before composer install. Key: ${{ runner.os }}-composer-phpstan-${{ hashFiles('composer.lock', 'composer.json') }}.

phpunit.yml

  • Caches the Composer cache dir after setup-php, before the WordPress install / composer install steps. Key: ${{ runner.os }}-php${{ matrix.php }}-composer-${{ hashFiles('composer.lock', 'composer.json') }}.

Not changed

  • The PHP syntax lint versions (5.6 and 8.0) were kept because the plugin declares Requires PHP: 5.6.
  • matrix.wordpress is defined in phpunit.yml, so the job name is fine as is.

Testing

These workflows are label-gated, so they only run once a PR has the run analysis (PHPCS / PHPStan) or run tests (PHPUnit) label. YAML for each changed file was validated locally.

@sorinmarta
sorinmarta merged commit 0072caf into master Nov 9, 2026
4 checks passed
@sorinmarta
sorinmarta deleted the ci/reduce-actions-cost branch November 9, 2026 18:56
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