ci-github-actions
Skill4 starsChanged 4 months agoMITView on GitHub
Build a fast, reliable GitHub Actions pipeline for PHP — version matrix, Composer caching, and PHPStan plus Pest quality gates. Use when the user wants to run their test suite against several PHP versions in a build matrix; the user wants a GitHub Actions workflow that installs, tests, and statically analyzes a PHP project on every push or pull request; the user wants to cache Composer dependencies and parallelize steps to make a slow PHP CI run faster. Keywords: ci, github-actions, matrix, phpstan, pest, composer-cache.
In this repository119 other files it gives its agents.
- strategy-bitrix-d7-incrementalSkill
- strategy-explicit-over-magicSkill
- strategy-framework-conventionsSkill
- strategy-legacy-safe-editsSkill
- strategy-minimal-diffSkill
- strategy-no-untested-refactorSkill
- strategy-preserve-public-apiSkill
- strategy-readonly-immutabilitySkill
- strategy-security-firstSkill
- strategy-test-drivenSkill
- openapiSkill
- paginationSkill
- rest-designSkill
- versioningSkill
- cqrsSkill
- dependency-inversionSkill
- hexagonalSkill
- repository-patternSkill
- service-layerSkill
- bitrixSkill
- findings-reportSkill
- laravelSkill
- performanceSkill
- phpSkill
- project-analysisSkill
- refactoringSkill
- roi-prioritizationSkill
- securitySkill
- stack-detectionSkill
- cache-layersSkill
- component-engineSkill
- d7-eventsSkill
- d7-loaderSkill
- d7-orm-queriesSkill
- iblock-elementsSkill
- kernel-main-moduleSkill
- localizationSkill
- controllersSkill
- ormSkill
- validationSkill
- controllersSkill
- query-builderSkill
- routingSkill
- autoload-psr4Skill
- dependency-managementSkill
- scriptsSkill
- connection-poolingSkill
- mysql-indexingSkill
- redisSkill
- transactionsSkill
- deployment-strategiesSkill
- docker-phpSkill
- env-configSkill
- associationsSkill
- entities-mappingSkill
- orm-basicsSkill
- entity-apiSkill
- module-developmentSkill
- routing-controllersSkill
- formsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 65
Do not apply this skill's GitHub Actions YAML when the project's CI system is GitLab CI, Jenkins, or CircleCI.
- Distinctive: line 66
Do not use this skill for zero-downtime release mechanics or rollback logic.
- Very specific: line 79
Create .github/workflows/ci.yml triggered on push and pull_request, with a strategy.matrix.php listing the supported versions and …
- Very specific: line 81
Add shivammathur/setup-php with the matrix version and required extensions, then install dependencies with a cache keyed on the …
- Very specific: line 83
Add a PHPStan step at a pinned level and a pest step (coverage on one cell), neither using continue-on-error, so a regression blocks the …
- Very specific: line 88
Run ./vendor/bin/pest (with --coverage on one matrix cell only) and fail the job on any failing test or a coverage drop below the threshold
- Very specific: line 90
Add a dedicated PHPStan step with a pinned level and no continue-on-error, so static-analysis regressions block the merge
- Distinctive: line 121
Not applicable — no I/O, auth, or untrusted input.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- generated: do not edit — source: knowledge/atoms/devops/ci-github-actions/ --><!-- schema: atomVersion=3 skillVersion=2 graphVersion=1 --><!-- compile: @php-skills/compiler v1.0.0 (deterministic build) -->PHP CI with GitHub Actions
When to use
- The user wants to run their test suite against several PHP versions in a build matrix.
- The user wants a GitHub Actions workflow that installs, tests, and statically analyzes a PHP project on every push or pull request.
- The user wants to cache Composer dependencies and parallelize steps to make a slow PHP CI run faster.
When NOT to use
- Do not apply this skill's GitHub Actions YAML when the project's CI system is GitLab CI, Jenkins, or CircleCI.
- Do not use this skill for zero-downtime release mechanics or rollback logic; those belong to the deployment skill.
Core guidance
- Cache the Composer cache dir keyed by composer.lock — Cache Composer's global cache directory with a key derived from a hash of
composer.lock, and use theramsey/composer-installaction or an explicit restore. - Test the versions you actually support in a matrix — Declare a
strategy.matrix.phplisting exactly the PHP versions in your support policy, and setfail-fast: falseso one version's failure is visible. - Use shivammathur/setup-php to provision the runtime — Provision PHP with the
shivammathur/setup-phpaction, declaring the exactphp-version, requiredextensions, andcoveragedriver per job.
Quick recipe
- Create
.github/workflows/ci.ymltriggered onpushandpull_request, with astrategy.matrix.phplisting the supported versions andfail-fast: false. (verify: The workflow shows one job per PHP version on the next pull request) - Add
shivammathur/setup-phpwith the matrix version and required extensions, then install dependencies with a cache keyed on thecomposer.lockhash. (verify: A second run reports a cache hit and finishes install in seconds) - Add a PHPStan step at a pinned level and a
peststep (coverage on one cell), neither usingcontinue-on-error, so a regression blocks the merge. (verify: Introducing a type error or failing test turns the required check red)
Best practices
- Run
./vendor/bin/pest(with--coverageon one matrix cell only) and fail the job on any failing test or a coverage drop below the threshold - Add a dedicated PHPStan step with a pinned level and no
continue-on-error, so static-analysis regressions block the merge - Reference third-party actions by a pinned major tag (or a full commit SHA for security-sensitive pipelines) rather than a floating branch
Anti-patterns
| Anti-pattern | Why it fails | Do instead |
| Quality gates marked continue-on-error | The pipeline reports success while real failures accumulate, so the gate protects nothing. | Let the analysis and test steps fail the job; fix or explicitly baseline the errors instead of masking them. |
| Referencing actions by a floating branch | An upstream push can change or compromise your pipeline with no commit in your repository, a supply-chain risk. | Pin to a released major tag, or a full commit SHA for security-critical pipelines, and update deliberately. |
| Running composer install with no dependency cache | Every run re-downloads the full dependency tree, wasting minutes and CI budget on unchanged dependencies. | Cache the Composer cache directory keyed on the lockfile hash and install with --prefer-dist --no-progress. |
See references/anti-patterns.md.
Common mistakes
- Cache key not tied to the lockfile serves stale dependencies — A Composer cache key that omits the
composer.lockhash keeps restoring old packages after a dependency bump. Fix: Key the cache onhashFiles('**/composer.lock')so any dependency change produces a fresh cache while unchanged runs stay fast. - pull_request from a fork cannot read secrets — Jobs triggered by
pull_requestfrom a fork run without access to repository secrets, so secret-dependent steps fail. Fix: Keep secret-free checks onpull_request, and move steps needing secrets to a gatedpull_request_targetor a post-merge workflow with explicit review. - Tests fail in CI because an extension is missing — Forgetting to list required extensions in setup-php makes CI fail with a missing-driver error even though local tests pass. Fix: Declare every runtime and test extension in the
extensionsinput of setup-php, mirroring what the Docker image installs.
Version notes
- setup-php spans PHP 7.4 through 8.4 (PHP >=7.4) —
shivammathur/setup-phpprovisions every PHP from 7.4 to 8.4, so the same matrix job template covers a legacy 7.4 target and a modern 8.4 target.
Security
- Not applicable — no I/O, auth, or untrusted input.
Testing
- Activation and decision behavior are verified in
eval/scenarios/devops/ci-github-actions.yaml. - Run
./vendor/bin/pest(with--coverageon one matrix cell only) and fail the job on any failing test or a coverage drop below the threshold.
Additional resources
- references/anti-patterns.md
- references/core.md
- references/examples.md
- references/pitfalls.md
- references/recipes.md
- references/version-differences.md
Knowledge graph
Related: devops/deployment-strategies, devops/docker-php, phpstan/getting-started, testing/pest-basics
<!-- graph-fragment: graph/fragments/devops/ci-github-actions.yaml -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

