Support publish workflow when ignore option is set #245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #241
The current implementation of using
readChangesetState()
on entry is based on@changesets/read
which simply reads all of the markdown files in.changeset
directory.Trigging the action while using the
ignore
option with changeset files present for both ignored and non-ignored packages, theversion
will run and consume changesets made for non-ignored packages, but leave those of ignored packages. When the PR is merged and the action is run again in this state, instead of moving on to thepublish
flow, it still enters theversion
flow and tries to make a PR, which fails as there are no releasable packages in this state.The fix incorporates
@changesets/get-release-plan
which actually returns a list ofreleases
which takes into account the ignored packages config. The flow control now utilizes this list to determine whether there's anything to version or publish.I've done some testing of this change at https://github.com/augustjk/changesets-test-project/actions and confirmed publishing with ignored packages works.
Open questions:
hasReleases
for the control to better reflect this, and added to the output. ThehasChangesets
variable and output no longer really serve a purpose within the code. I've left it here so as not to break users currently using this output as advertised on the README. Is this acceptable?releases
instead ofchangesets
might have some other consequences that I'm not thinking of.