Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support publish workflow when ignore option is set #245

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

augustjk
Copy link

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, the version 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 the publish flow, it still enters the version 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 of releases 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:

  • I've created the variable as hasReleases for the control to better reflect this, and added to the output. The hasChangesets 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?
  • I'm unsure whether this should be a minor or patch bump. Leaving the output above should keep this non-breaking, but using the count of releases instead of changesets might have some other consequences that I'm not thinking of.

@changeset-bot
Copy link

changeset-bot bot commented Dec 16, 2022

⚠️ No Changeset found

Latest commit: 08128b4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publishing via action while using "ignore" option
1 participant