[v2] Nested Changesets projects cannot be used: working-directory is invalid on uses steps
Summary
changesets/action@v2.0.0 removed the cwd input in #659. The associated changeset says to use the step-level working-directory option instead.
However, GitHub Actions only supports working-directory for run steps, not uses steps. This leaves no supported way to run the v2 action when the Changesets project root is a subdirectory of the repository.
The action then uses process.cwd() as its project directory:
https://github.com/changesets/action/blob/v2.0.0/src/index.ts#L13-L16
Minimal repository
.
├── .github/workflows/release.yml
├── packages/example/package.json
└── tools/release
├── .changeset/config.json
├── .changeset/fuzzy-cats-smile.md
└── package.json
tools/release/package.json is a private workspace root with @changesets/cli@^3.0.0 and ../../packages/example as a workspace.
The Changesets CLI works from that directory and calculates the expected release:
$ cd tools/release
$ ./node_modules/.bin/changeset status --output status.json
🦋 changeset v3.0.0
# status.json contains example-package 1.0.0 -> 1.0.1
Reproduction A: documented replacement is invalid workflow syntax
- run: npm install --ignore-scripts
working-directory: tools/release
- uses: changesets/action@v2.0.0
working-directory: tools/release
Strict workflow validation fails:
$ act --strict --validate --dryrun -W .github/workflows/release.yml
Unknown Property working-directory
GitHub documents jobs.<job_id>.steps[*].working-directory as an option for run steps:
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsworking-directory
Reproduction B: schema-valid workflow runs the action at repository root
Removing working-directory from the uses step makes the workflow valid:
- run: npm install --ignore-scripts
working-directory: tools/release
- uses: changesets/action@v2.0.0
Running it produces:
$ act workflow_dispatch --bind --container-architecture linux/amd64 \
-P ubuntu-latest=catthehacker/ubuntu:act-latest \
-W .github/workflows/release-root.yml
::error::Error: No package.json could be found upwards from directory <repository-root>
The nested install succeeds before the action is invoked. The error occurs because the action uses the repository root as cwd, where this fixture intentionally has no package.json.
Expected behavior
There should be a supported way to specify a nested Changesets project root, as there was with the v1 cwd input.
Restoring a cwd input (or adding a project-directory input) and resolving it against github.workspace would address this. A regression test should cover a repository whose .changeset, package manager manifest, and Changesets CLI installation are all below the repository root.
Versions
changesets/action: v2.0.0
@changesets/cli: 3.0.0
act: 0.2.89
- Node:
24.19.0
Related history
[v2] Nested Changesets projects cannot be used:
working-directoryis invalid onusesstepsSummary
changesets/action@v2.0.0removed thecwdinput in #659. The associated changeset says to use the step-levelworking-directoryoption instead.However, GitHub Actions only supports
working-directoryforrunsteps, notusessteps. This leaves no supported way to run the v2 action when the Changesets project root is a subdirectory of the repository.The action then uses
process.cwd()as its project directory:https://github.com/changesets/action/blob/v2.0.0/src/index.ts#L13-L16
Minimal repository
tools/release/package.jsonis a private workspace root with@changesets/cli@^3.0.0and../../packages/exampleas a workspace.The Changesets CLI works from that directory and calculates the expected release:
Reproduction A: documented replacement is invalid workflow syntax
Strict workflow validation fails:
GitHub documents
jobs.<job_id>.steps[*].working-directoryas an option forrunsteps:https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsworking-directory
Reproduction B: schema-valid workflow runs the action at repository root
Removing
working-directoryfrom theusesstep makes the workflow valid:Running it produces:
The nested install succeeds before the action is invoked. The error occurs because the action uses the repository root as
cwd, where this fixture intentionally has nopackage.json.Expected behavior
There should be a supported way to specify a nested Changesets project root, as there was with the v1
cwdinput.Restoring a
cwdinput (or adding aproject-directoryinput) and resolving it againstgithub.workspacewould address this. A regression test should cover a repository whose.changeset, package manager manifest, and Changesets CLI installation are all below the repository root.Versions
changesets/action:v2.0.0@changesets/cli:3.0.0act:0.2.8924.19.0Related history
cwdand introduced this regression.