{"id":17205441,"url":"https://github.com/valentinh/gh-actions-nested-matrices","last_synced_at":"2026-06-12T16:32:43.008Z","repository":{"id":66077402,"uuid":"564928796","full_name":"ValentinH/gh-actions-nested-matrices","owner":"ValentinH","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-12T21:37:57.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T10:22:06.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValentinH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-11T20:56:25.000Z","updated_at":"2022-11-11T20:57:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"33d02b38-c06d-4328-b21b-fa449ce70330","html_url":"https://github.com/ValentinH/gh-actions-nested-matrices","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ValentinH/gh-actions-nested-matrices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinH%2Fgh-actions-nested-matrices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinH%2Fgh-actions-nested-matrices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinH%2Fgh-actions-nested-matrices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinH%2Fgh-actions-nested-matrices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValentinH","download_url":"https://codeload.github.com/ValentinH/gh-actions-nested-matrices/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinH%2Fgh-actions-nested-matrices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34253930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-15T02:25:20.960Z","updated_at":"2026-06-12T16:32:42.990Z","avatar_url":"https://github.com/ValentinH.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GH Actions with nested matrices\n\nThis repository contains an example monorepo (created with [the official Turborepo example](https://turbo.build/repo/docs/getting-started/create-new)).\nThe monorepo isn't the point here: the goal is to present a technique to build Github Actions made of dynamically nested matrices.\n\nIndeed, GH Actions allows creating matrices like documented [here](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs).\nThe examples only shows how to create static matrices but there are multiple blog posts explaining how to dynamically generate matrices using the `fromJSON()` function such as [this one](https://michaelheap.com/dynamic-matrix-generation-github-actions/).\n\nHowever, I needed to go even further: have nested matrices with the second one being dynamic! \nHere's my use case:\n1. create a matrix of each app/package to test\n2. for each target, create a dynamic matrix to split the tests in multiple jobs\n\nFor a while, I thought that this was not possible because the current actions syntax doesn't allow specifying such a setup.\nHowever, today I discovered a feature called [reusable workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflow) (never too late) which enables us to achieve what I described above! 🎉\n\nIndeed, you can call a reusable workflow from within a matrix like this:\n```yaml\n  test:\n    strategy:\n      fail-fast: false\n      matrix:\n        scope: ['web', 'docs', 'ui']\n\n    uses: ./.github/workflows/test.yml\n    with:\n      target: ${{ matrix.scope }}\n ```\n \n And then, you can create a dynamic matrix inside the reusable workflow! 😎\n \n The actions graph doesn't nicely renders the nested matrices (yet) but it works fine:\n \u003cimg width=\"642\" alt=\"image\" src=\"https://user-images.githubusercontent.com/2678610/201440067-df12f2e3-897d-4d30-bb8f-2887a0a88883.png\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinh%2Fgh-actions-nested-matrices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinh%2Fgh-actions-nested-matrices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinh%2Fgh-actions-nested-matrices/lists"}