8 CI/CD for API artifacts 1: Source-stage governance controls
Large organizations often have many teams producing external APIs, and manual governance by a central review group does not scale well. To reduce slow reviews, inconsistent practices, and developer frustration, the chapter argues that API definitions and related deliverables should be treated as code and managed inside the CI/CD pipeline. That way, teams can get fast, repeatable feedback on design quality, conformance to style guidance, and the generation of API-related outputs such as documentation, SDKs, and score reports.
The chapter then shows how a pull request–based workflow can become the entry point for API governance. Instead of exchanging files and feedback through email, API design proposals live in version control and are reviewed through PRs. A minimum design review criteria gate is established so PRs must satisfy automated checks before governance review begins. These checks include validating the PR title for a work ticket reference, running API linting, checking for breaking changes, and optionally running prose linting on documentation, while code owner approval ensures that the governance team must sign off before merge.
Finally, the chapter broadens the discussion from individual checks to pipeline design and API artifact management. It explains how build server automation can enforce quality gates, provide clear failure feedback, and keep reviews fast, while also emphasizing practical concerns like branch protection, team roles, and reporting. It then introduces multifile API definitions as a way to manage large OpenAPI documents by splitting reusable components into separate files, bundling them when needed, and using tooling or design collaboration platforms to support maintainability and reuse without sacrificing governance.
An example flow of files and conversation between the governance team and a development team during the review of an API design change proposal
The process the Acme team uses to check that PRs satisfy the minimum design review criteria and get approval from the governance team
The Acme team’s deployment pipeline
GitHub Actions concepts applied to the PR build workflow. On the GitHub Actions platform, events trigger workflows that are executed on runners.
Extending the workflow file with a new job to validate the MDRC
Output from running Vale on the API guide documentation
Setting up GitHub branch protection rules
Code owner reviews are required on PRs that change files in the chapter8/apis directory.
The structure of an external OpenAPI reference
An example of the directory structure containing a multifile OpenAPI document
Summary
- API governance teams can define minimum design review criteria (MDRC)—a set of automated checks that API design change proposals must pass before they go through a PR review. These automated checks in the pipeline should include API linting, breaking change checks, and any other automated checks the governance team thinks are important.
- Using PR templates to prompt API designers to provide contextual information on why API design change PR is required helps PR reviewers understand the reason and scope of changes and helps them review it quicker.
- Assigning code owners to files is a technique for requiring domain experts to review and approve changes to files in a team’s source repository. You can set members of the API governance team as code owners for API definition files to enforce that all design changes are reviewed by them.
- Prose linters such as Vale can run in your PR build to check API guide documentation files for punctuation, spelling, grammar, style, and readability.
- When using an API design collaboration tool, you can integrate with the source repository that contains your API definition files. Ensure the version-controlled source repository is the primary store of the API definition files.
- Splitting API definition files into multiple files helps you make them more manageable and enhances collaboration on them with multiple teams. It also promotes the reuse of shared API components.
FAQ
Why should API definitions and related documentation be stored in version control instead of being shared by email or chat?
Storing API definition files and guide documentation in version control creates a single source of truth, preserves file history, makes changes easy to review with diffs, and supports scalable collaboration through pull requests instead of scattered manual conversations.What is a minimum design review criteria (MDRC) in an API delivery pipeline?
An MDRC is a set of automated checks that API design proposals must pass before human review begins. In this chapter, it includes checks like PR title validation, API linting, breaking change detection, and prose linting for documentation.How does a PR build help automate API governance?
A PR build runs automated checks when a pull request is created or updated. It gives fast feedback on API consistency, breaking changes, and documentation quality, so the governance team only reviews proposals that already meet the required baseline.Why is a PR template useful for API design proposals?
A PR template prompts the submitter to include the reason for the change, the scope of the change, and a checklist. This improves review context and helps the governance team understand the proposal without having to ask for basic details.How can a workflow validate that a PR title contains a work ticket reference?
A script can check the PR title against a required pattern such asDEV-XXXX. If the title does not match, the workflow fails and tells the submitter to add a valid ticket reference.How are API linting checks run in the GitHub Actions workflow?
The workflow can run Spectral from the runner usingnpx, linting the OpenAPI definition against the project ruleset. This lets the pipeline fail on serious API style violations without needing a separate manual review first.How are breaking changes detected between the PR branch and the main branch?
The workflow checks out the main branch into a separate folder and uses a tool such asoasdiff to compare the baseline API definition with the one in the PR branch. If a path or other contract detail was removed or changed unsafely, the build fails.
Automating API Delivery ebook for free