{"id":21041190,"url":"https://github.com/alexshukel/get-changed-workspaces-action","last_synced_at":"2025-06-25T02:06:08.580Z","repository":{"id":45051792,"uuid":"445221132","full_name":"AlexShukel/get-changed-workspaces-action","owner":"AlexShukel","description":"This action finds all workspaces in monorepo that has changed files.","archived":false,"fork":false,"pushed_at":"2022-11-06T13:41:57.000Z","size":1761,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T11:49:41.451Z","etag":null,"topics":["actions","changes","github-actions","monorepo","npm","workspace","workspaces"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/AlexShukel.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":null,"security":null,"support":null}},"created_at":"2022-01-06T15:38:47.000Z","updated_at":"2024-11-01T23:50:56.000Z","dependencies_parsed_at":"2022-09-23T01:51:57.356Z","dependency_job_id":null,"html_url":"https://github.com/AlexShukel/get-changed-workspaces-action","commit_stats":{"total_commits":99,"total_committers":3,"mean_commits":33.0,"dds":"0.31313131313131315","last_synced_commit":"f6f1f6871af68c60fe918090aecda3e58f987de4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/AlexShukel/get-changed-workspaces-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexShukel%2Fget-changed-workspaces-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexShukel%2Fget-changed-workspaces-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexShukel%2Fget-changed-workspaces-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexShukel%2Fget-changed-workspaces-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexShukel","download_url":"https://codeload.github.com/AlexShukel/get-changed-workspaces-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexShukel%2Fget-changed-workspaces-action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261789227,"owners_count":23209774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["actions","changes","github-actions","monorepo","npm","workspace","workspaces"],"created_at":"2024-11-19T13:50:59.301Z","updated_at":"2025-06-25T02:06:08.557Z","avatar_url":"https://github.com/AlexShukel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Get changed workspaces action\r\n\r\nThis action finds all `workspaces` in monorepo that has changed files. Then, you can build, test and lint only those packages that has been changed. If you aren't familiar with npm `workspaces`, see documentation for [npm](https://docs.npmjs.com/cli/v7/using-npm/workspaces) and [yarn](https://yarnpkg.com/features/workspaces).\r\n\r\n## Usage\r\n\r\n1. Create new workflow inside `.github/workflows`\r\n\r\n**Example configuration**\r\n\r\n```yml\r\nname: Monorepo CI\r\non:\r\n    pull_request:\r\n        branches:\r\n            - main\r\n            - master\r\njobs:\r\n    get-changed-workspaces:\r\n        runs-on: ubuntu-latest\r\n        outputs:\r\n            packages: ${{ steps.changed-packages.outputs.packages }}\r\n            empty: ${{ steps.changed-packages.outputs.empty }}\r\n        steps:\r\n            - uses: actions/checkout@v2\r\n            - name: Find changed workspaces\r\n              uses: AlexShukel/get-changed-workspaces-action@v2.0.0\r\n              id: changed-packages\r\n    build:\r\n        runs-on: ubuntu-latest\r\n        needs: [get-changed-workspaces]\r\n        strategy:\r\n            matrix:\r\n                package: ${{ fromJson(needs.get-changed-workspaces.outputs.packages) }}\r\n        steps:\r\n            # describe steps for each modified package using ${{ matrix.package.name }} and ${{ matrix.package.path }}\r\n```\r\n\r\n2. Define `workspaces` in root `package.json`. Also it can be passed via action input [workspaces](#workspaces).\r\n\r\n## Events that can trigger action\r\n\r\nThis action can handle 2 types of events:\r\n\r\n-   `pull_request` - action will compare `current` branch with `target` branch of pull request.\r\n-   `push` - by default action will compare a commit `before` push event occured with `current` commit. You can pass `base-ref` input to make another comparison (for example, with main branch).\r\n\r\n## Action inputs\r\n\r\nBelow is the list of all possible options that can be passed in the action.\r\n\r\n### workspaces\r\n\r\nThis input is an alternative to the property of `package.json`. It should be similar to [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces#defining-workspaces). One difference is that each element of array should be on the new line.\r\nExample:\r\n\r\n```yml\r\n- uses: AlexShukel/get-changed-workspaces-action@v2.0.0\r\n  with:\r\n      workspaces: |\r\n          packages/*\r\n          tools/*\r\n          app/frontend\r\n```\r\n\r\n### working-directory\r\n\r\nThis input is required when your monorepo is located in different directory than git root.\r\nExample:\r\n\r\n```yml\r\n- uses: AlexShukel/get-changed-workspaces-action@v2.0.0\r\n  with:\r\n      working-directory: ./app/frontend\r\n```\r\n\r\n### filter\r\n\r\nThis input option (regular expression) allows to filter changed packages by their names. Example:\r\n\r\n```yml\r\n- uses: AlexShukel/get-changed-workspaces-action@v2.0.0\r\n  with:\r\n      filter: \"@packages/*\"\r\n```\r\n\r\nThis filter will select only those packages that match \"@packages/\\*\" regular expression.\r\n\r\n### base-ref\r\n\r\nThis input affects execution only when `push` event occurs. You can specify target of comparison (branch name or commit SHA).\r\nExample:\r\n\r\n```yml\r\n- uses: AlexShukel/get-changed-workspaces-action@v2.0.0\r\n  with:\r\n      base-ref: main\r\n```\r\n\r\n## Action outputs\r\n\r\nBelow is the list of all possible outputs that this action produces.\r\n\r\n### packages\r\n\r\nArray of changed packages, each containing its name and path. Provided as JSON string.\r\n\r\nExample: '[{\"name\":\"@monorepo/core\",\"path\":\"packages/core\"},{\"name\":\"@monorepo/react\",\"path\":\"packages/react\"}]'\r\n\r\nIf you want to use it in action [matrix](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix), parse input with [fromJson](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson).\r\n\r\n### empty\r\n\r\nBoolean that indicates if there was any changed packages. Provided as JSON string.\r\n\r\nFor example, if you want to skip a job when there was no changed packages, you can use this configuration:\r\n\r\n```yml\r\ngenerate_matrix:\r\n    name: Get changed packages\r\n    runs-on: ubuntu-latest\r\n    outputs:\r\n        empty: ${{ steps.changed_packages.outputs.empty }}\r\n    steps:\r\n        - name: Checkout\r\n          uses: actions/checkout@v2\r\n\r\n        - name: Find changed packages\r\n          id: changed_packages\r\n          uses: alexshukel/get-changed-workspaces-action@v2.0.0\r\nbuild:\r\n    name: Build\r\n    # Skip build job if there wasn't any changed packages\r\n    if: ${{ !fromJson(needs.generate_matrix.outputs.empty) }}\r\n```\r\n\r\n## License\r\n\r\nMIT © [Aleksandras Sukelovic](https://github.com/AlexShukel)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexshukel%2Fget-changed-workspaces-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexshukel%2Fget-changed-workspaces-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexshukel%2Fget-changed-workspaces-action/lists"}