JSON to Variables Setter

Overview
JSON to Variables Setter (json2vars-setter) is a GitHub Action that parses a JSON file and sets its values as output variables in GitHub Actions workflows. This action streamlines the management of matrix testing configurations and other workflow variables, making your CI/CD processes more maintainable and adaptable.
By centralizing your configuration in JSON files, you gain the ability to easily manage and update testing environments across multiple workflows, reducing duplication and maintenance overhead.
Key Features
- JSON Parsing: Convert JSON files into GitHub Actions output variables for use in your workflows
- Dynamic Version Management: Automatically update your testing matrix with latest language versions from official sources
- Version Caching: Cache version information to reduce API calls and improve workflow performance
- Support for Multiple Languages: Compatible with Python, Ruby, Node.js, Go, Rust, PHP, .NET (C#), Java, Deno, Bun, Zig, Elixir, Dart, and Swift
- Flexible Configuration: Maintain a single source of truth for your matrix testing environments
Supported Matrix Components
| Languages | Actions | Example Test Status |
|---|---|---|
📖 Per-language details — supported OS, versions, and the setup action each example drives — are in the Languages section.
Sample Workflows
Beyond the per-language tests above, these runnable use-case samples live in the repository and execute on real GitHub Actions. The green badge is proof you can reproduce the result, then copy the files into your own project — no local setup required to gain confidence.
| Use case | Status | What it demonstrates | Files |
|---|---|---|---|
| Single source of truth | One JSON parsed once, then consumed by an independent test matrix and a separate lint job — define versions in one place, use them everywhere |
||
| Monorepo | Several projects in one repo, each with its own matrix JSON (Python backend + Node.js frontend) and an independent test matrix | ||
| Template from cache | Generate a matrix from an existing version cache with no API calls (template-only), trimmed via output-count |
||
| Version cache | Drive a multi-version matrix from a committed cache (use-cache) — zero API calls on a cache hit, auto-refresh when cache-max-age is exceeded |
||
| Dynamic update (scheduled) | Weekly scheduled maintenance: fetch the latest language versions from the live API (update-matrix) and rebuild the matrix — side-effect-free (no commit) |
||
| Conditional matrix | Pick the matrix by event — a light, fast matrix on pull requests and the full cross-OS matrix on schedule / dispatch | ||
| Reusable workflow | Define the matrix once in a workflow_call library and consume its outputs from a caller — maintain the version set in one place |
Quick Start
See Basic Usage Examples for details.
Components
The action consists of three main components that work together to provide a powerful, flexible solution:
graph TD
subgraph "JSON to Variables Setter"
A[JSON to Variables Parser ] -->|Reads| B[Matrix JSON File]
A -->|Sets| C[GitHub Actions Outputs]
D[Dynamic Matrix Updater] -->|Updates| B
D -->|Fetches from| E[GitHub API]
F[Version Cache Manager] -->|Caches| G[Version Information]
F -->|Fetches from| E
F -->|Generates| B
end
C -->|Used by| I[GitHub Workflows]
classDef core fill:#43a047,stroke:#2e7d32,stroke-width:2px,color:#fff
classDef file fill:#ffca28,stroke:#fb8c00,stroke-width:1px,color:#333333
classDef output fill:#42a5f5,stroke:#1976d2,stroke-width:1px
classDef external fill:#78909c,stroke:#546e7a,stroke-width:1px
classDef api fill:#e91e63,stroke:#c2185b,stroke-width:1px,color:#fff
class A,D,F core
class B,G file
class C output
class I external
class E api
-
JSON to Variables Parser (
github_output.py): Core component that parses JSON and converts it to GitHub Actions outputs. Makes your configuration data accessible throughout your workflow. -
Dynamic Matrix Updater (
matrix_update.py): Updates your matrix configuration with the latest or stable language versions. Ensures your CI/CD tests run against current language versions without manual updates. -
Version Cache Manager (
version_cache.py): Manages cached version information to optimize API usage. Reduces external API calls by intelligently caching data, improving workflow performance and reliability.
Learn More
- Getting Started - Basic setup and configuration
- Features - Detailed explanation of all features
- Usage Examples - Common usage patterns and examples
- Command Options - Complete reference of all available options