ci: improve the API-spec workflow (adopted from os2display) - #40
Merged
Conversation
Adopt the stronger parts of os2display/display-api-service's apispec workflow, keeping our Task-based export and single public/spec.yaml: - Path-filtered trigger so the job only runs when the spec can actually change (src, config, composer, docker-compose, the spec itself). - Least-privilege `permissions:` (contents: read, pull-requests: write) on both jobs. - Cache vendor/ between runs. - Replace openapitools/openapi-diff with oasdiff (maintained, richer markdown changelog); post a single sticky PR comment that updates in place and resolves when the diff clears.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #40 +/- ##
==========================================
Coverage 71.89% 71.89%
Complexity 226 226
==========================================
Files 29 29
Lines 637 637
==========================================
Hits 458 458
Misses 179 179
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…s2display # Conflicts: # CHANGELOG.md
…s2display # Conflicts: # .github/workflows/api-spec.yml # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopt the stronger parts of os2display/display-api-service's apispec workflow, keeping our Task-based export and single
public/spec.yaml.Changes to
api-spec.ymltask site:update) now runs only when the spec can actually change:src/**/*.php,config/**,composer.json/.lock,docker-compose*.yml,public/spec.yaml. Previously it ran on every PR.permissions:—contents: read+pull-requests: writeon both jobs (they comment on PRs).actions/cache@v5keyed oncomposer.lock.openapitools/openapi-diffDocker image withoasdiff/oasdiff-action@v0.0.44(maintained Go tool, richer markdown changelog +fail-on: ERR). Includes theheaders: [] → {}sanitisation shim oasdiff needs. Posts a single sticky PR comment (HTML-marker keyed) that updates in place and is marked resolved when the diff clears — no comment pile-up.Deliberately not adopted
Task→docker-compose switch (we use
taskfor local-dev parity), and JSON spec export (no consumer here).Notes
github.base_refis passed viaenv:and quoted (workflow-injection hygiene), though it's the repo-controlled target branch, not attacker input.api-specis a required status check, PRs that don't touch those paths won't report it — adjust branch protection to "not required when skipped" if needed.prettier + markdownlint clean. (Behavioural verification happens on the PR's own CI run, since it's a workflow change.)