CI with YINI CLI
Validate YINI files in CI and catch configuration mistakes early.
If you use YINI for configuration, validating your files automatically is one of the simplest ways to catch mistakes before they reach a build, deploy, or release step.
The YINI CLI makes this straightforward. You can run a single command to check that your YINI files are valid, both during local development and in CI.
Why use YINI CLI in CI?
Using YINI CLI in CI helps you:
- Catch broken configuration before it reaches production.
- Keep configuration changes safe in pull requests.
- Make config validation part of a normal build workflow.
- Work with human-friendly config without giving up automation.
This is especially useful when configuration is edited by multiple people or used across different environments.
Basic validation command
The simplest CI-friendly command is:
npx yini-cli validate ./config.yiniIf the file is valid, the command exits successfully.
If the file has errors, the command returns a non-zero exit code, which makes it useful in CI pipelines and build scripts.
Example: npm script
A simple way to add validation to a project is to define a script in package.json (Node.js):
{
"scripts": {
"config:check": "npx yini-cli validate ./config.yini"
}
}Then run:
npm run config:checkExample: use strict mode
If you want stricter validation, use:
npx yini-cli validate --strict ./config.yiniThis is useful when you want CI to enforce a stricter interpretation of the format.
Example: GitHub Actions
Here is a small GitHub Actions workflow that validates a YINI file on push and pull request:
name: Validate YINI config
on:
push:
pull_request:
jobs:
validate-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Validate config
run: npx yini-cli validate ./config.yiniThis is often enough to catch accidental mistakes early.
Real configuration used by this site
This website itself uses a YINI configuration file, so the workflow shown on this page is a real example rather than only a theoretical one.
The source configuration file lives in the yini-homepage repository:
site-config.yiniYou can view the repository here:
github.com/YINI-lang/yini-homepage
Example snippet from site-config.yini:
^ siteLinks
^^ hero
^^^ home
url = '/'
title = 'Home β YINI homepage'
^^^ getStarted
url = '/use-yini/get-started'
title = 'Start exploring the YINI format.'YINI build workflow/pipeline used on this site
During the build workflow, the YINI file is converted to JSON with yini-cli:
npx yini-cli parse site-config.yini --output src/config/site-config.jsonThis parses site-config.yini and generates src/config/site-config.json for the Astro application to use.
The generated JSON file is then read by the Astro application through config.ts.
site-config.yini (source of truth)
β
yini-cli (converts YINI to JSON)
β
site-config.json (generated file; do not edit directly)
β
config.ts (reads the generated JSON)
β
Astro applicationThis makes site-config.yini the human-friendly source file, while the application still consumes generated JSON in a predictable way.
This pattern works well when you want:
- Readable source configuration for humans.
- JSON output for existing tools or application code.
- Validation during build or CI before bad configuration reaches production.
If you prefer runtime parsing instead, you can also use a YINI parser for your programming language and load YINI files directly in your application.
When this approach works well
Using YINI CLI in CI is a good fit when you want:
- Config files reviewed and validated in pull requests.
- Safer builds and deployments.
- A human-friendly source config format.
- A simple validation step that works well with npm scripts and CI pipelines.
Related tools
- β‘οΈ YINI CLI
Validate, inspect, and convert YINI files from CLI. - β‘οΈ YINI Parser
Load YINI directly in a Node.js app at runtime.
Learn more
- β‘οΈ Get Started
Installation and CLI usage overview. - β‘οΈ Learn the YINI syntax
A simple introduction to sections, values, nesting, and comments. - β‘οΈ Examples
See YINI examples from simple to more advanced. - β‘οΈ YINI Specification
The formal specification for the YINI format.
