{"id":16772586,"url":"https://github.com/jonlabelle/matrix-workflow-config","last_synced_at":"2026-02-11T16:33:14.847Z","repository":{"id":239016563,"uuid":"798272143","full_name":"jonlabelle/matrix-workflow-config","owner":"jonlabelle","description":"Reusable workflow that loads a matrix strategy from a JSON config file.","archived":false,"fork":false,"pushed_at":"2024-08-29T17:34:41.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T05:33:41.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonlabelle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-09T12:53:04.000Z","updated_at":"2024-08-29T17:34:45.000Z","dependencies_parsed_at":"2024-06-25T15:12:35.072Z","dependency_job_id":"389ad565-c605-49e4-9fbd-02bcf23a7147","html_url":"https://github.com/jonlabelle/matrix-workflow-config","commit_stats":null,"previous_names":["jonlabelle/matrix-workflow-config"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jonlabelle/matrix-workflow-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlabelle%2Fmatrix-workflow-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlabelle%2Fmatrix-workflow-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlabelle%2Fmatrix-workflow-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlabelle%2Fmatrix-workflow-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonlabelle","download_url":"https://codeload.github.com/jonlabelle/matrix-workflow-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlabelle%2Fmatrix-workflow-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29338338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T16:14:43.024Z","status":"ssl_error","status_checked_at":"2026-02-11T16:14:15.258Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T06:43:17.909Z","updated_at":"2026-02-11T16:33:14.833Z","avatar_url":"https://github.com/jonlabelle.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matrix config\n\n[![example](https://github.com/jonlabelle/matrix-workflow-config/actions/workflows/example.yml/badge.svg)](https://github.com/jonlabelle/matrix-workflow-config/actions/workflows/example.yml)\n\n\u003e A reusable workflow for loading a job's [matrix strategy](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs) from a JSON configuration file.\n\n## Usage\n\nSee [matrix-config.yml](https://github.com/jonlabelle/matrix-workflow-config/blob/main/.github/workflows/matrix-config.yml).\n\n## Examples\n\n### Using the matrix config (reusable) workflow\n\nHere's a basic example of how to load a matrix strategy from a config file.\n\n#### Matrix config file\n\nDefine your matrix strategy in a config file.\n\n```json\n{\n  \"include\": [\n    {\n      \"label\": \"My first item\",\n      \"server-name\": \"host01\",\n      \"enable\": true\n    },\n    {\n      \"label\": \"My second item\",\n      \"server-name\": \"host02\",\n      \"enable\": true\n    },\n    {\n      \"label\": \"I am configured, but not enabled. I will not be run.\",\n      \"server-name\": \"host03\",\n      \"enable\": false\n    }\n  ]\n}\n```\n\nJSON comments (or JSONC) are fully supported in config files.All comments are\nstripped before parsing.\n\n\u003e [!IMPORTANT]  \n\u003e GitHub only allows matrix configurations to be two-levels deep.\n\u003e Meaning, any item within the `include` array cannot have a value that is an\n\u003e object literal, or array.\n\nFor more information on configuring matrix strategies, see [GitHub's documentation](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs).\n\n#### Job setup\n\nHere's how you'll setup your job to call the matrix config reusable workflow,\nand load the configuration into your matrix strategy.\n\n```yaml\njobs:\n  load-matrix:\n    name: Load matrix\n    uses: jonlabelle/matrix-workflow-config/.github/workflows/matrix-config.yml@main\n    with:\n      config: ./.github/matrix-config/example.json\n\n  use-matrix:\n    name: Use matrix on ${{ matrix.server-name }}\n    needs: [load-matrix]\n    runs-on: ubuntu-latest\n    strategy:\n      matrix: ${{ fromJson(needs.load-matrix.outputs.matrix) }}\n    steps:\n      - name: ${{ matrix.label }}\n        if: ${{ matrix.enable }}\n        run: |\n          echo \"Server: ${{ matrix.server-name }}\"\n```\n\n### Extend your config at runtime\n\nYou can extend your matrix config (at runtime) by passing in additional\nkey-value pairs that will bind to each item in the `include` array.\n\n\u003e [!NOTE]  \n\u003e You can run this example from the [actions](https://github.com/jonlabelle/matrix-workflow-config/actions/workflows/example.yml) section of this repo.\n\n#### Job setup\n\n\u003e Here, we'll extend our config using the `extend` key, `'{ \"existing-key\": \"overridden by extend input option\", \"prop2\": \"value2\", \"prop3\": 3 }'`.\n\n```yaml\njobs:\n  load-matrix:\n    name: Load matrix\n    uses: ./.github/workflows/matrix-config.yml\n    # Use the following path when calling from your own repo/workflow\n    # uses: jonlabelle/matrix-workflow-config/.github/workflows/matrix-config.yml@main\n    needs: [show-matrix-config-file]\n    with:\n      config: ./.github/matrix-config/example.json\n\n      # Additional key/value pairs to bind to each item in matrix config's `include` array.\n      # If a key already exists, its value will be overwritten (for each item in the include array).\n      extend: '{ \"existing-key\": \"overridden by extend input option\", \"prop2\": \"value2\", \"prop3\": 3 }'\n\n      # If the provided value for extend is a flat array (e.g. '[\"one\", \"two\", \"three\"]'),\n      # then the matrix is also assumed to be a flat array, and the new values will simply\n      # be appended to the existed matrix array.\n      # extend: '[\"one\", \"two\", \"three\"]'\n\n  use-matrix:\n    name: Use matrix on ${{ matrix.server-name }}\n    needs: [show-matrix-config-file, load-matrix]\n    runs-on: [self-hosted, Linux, X64, onprem, enterprise]\n    strategy:\n      matrix: ${{ fromJson(needs.load-matrix.outputs.matrix) }}\n    steps:\n      - name: Show extended matrix config json\n        if: ${{ matrix.enable }}\n        run: echo '${{ needs.load-matrix.outputs.matrix }}' | jq '.' --color-output\n```\n\n#### Matrix config file (before extending)\n\nOriginal matrix json config file contents.\n\n```json\n{\n  \"include\": [\n    {\n      \"label\": \"My first item\",\n      \"server-name\": \"host01\",\n      \"enable\": true,\n      \"existing-key\": \"this value will be overridden by a value defined in the extend input option.\"\n    },\n    {\n      \"label\": \"My second item\",\n      \"server-name\": \"host02\",\n      \"enable\": true,\n      \"existing-key\": \"this value will be overridden by a value defined in the extend input option.\"\n    },\n    {\n      \"label\": \"I am configured, but not enabled. I will not be run.\",\n      \"server-name\": \"host03\",\n      \"enable\": false,\n      \"existing-key\": \"this value will be overridden by a value defined in the extend input option.\"\n    }\n  ]\n}\n```\n\n#### Matrix config output (after extending)\n\nMatrix json config after extending.\n\n```json\n{\n  \"include\": [\n    {\n      \"label\": \"My first item\",\n      \"server-name\": \"host01\",\n      \"enable\": true,\n      \"existing-key\": \"overridden by extend input option\",\n      \"prop2\": \"value2\",\n      \"prop3\": 3\n    },\n    {\n      \"label\": \"My second item\",\n      \"server-name\": \"host02\",\n      \"enable\": true,\n      \"existing-key\": \"overridden by extend input option\",\n      \"prop2\": \"value2\",\n      \"prop3\": 3\n    },\n    {\n      \"label\": \"I am configured, but not enabled. I will not be run.\",\n      \"server-name\": \"host03\",\n      \"enable\": false,\n      \"existing-key\": \"overridden by extend input option\",\n      \"prop2\": \"value2\",\n      \"prop3\": 3\n    }\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonlabelle%2Fmatrix-workflow-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonlabelle%2Fmatrix-workflow-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonlabelle%2Fmatrix-workflow-config/lists"}