Skip to content

Add select-mode, version, pack and publish sub-actions#656

Open
bluwy wants to merge 12 commits into
mainfrom
new-version-publish-subaction
Open

Add select-mode, version, pack and publish sub-actions#656
bluwy wants to merge 12 commits into
mainfrom
new-version-publish-subaction

Conversation

@bluwy

@bluwy bluwy commented Jun 15, 2026

Copy link
Copy Markdown
Member

Adds a very simple implementation of /select-mode, /version, and /publish sub-actions that reuses functions from the root action. I renamed some of the inputs, copied most of the logic over. There's probably more cleanup possible but I don't want to stray too far for now.

I also did not write any readme/docs as I'm lazy maybe it changes after the publish-plan PRs.

I made this PR mainly so we can make updates on it easier later, but I'm also fine closing this as starting from scratch with the publish-plan stuff if that's easier.

@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1c57c8c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/action Minor

Not sure what this means? Click here to learn what changesets are.

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

Comment thread version/action.yml Outdated
Comment thread version/action.yml Outdated
Comment thread src/version/index.ts Outdated
@Andarist Andarist force-pushed the new-version-publish-subaction branch from b6da0bd to 10ef577 Compare June 17, 2026 06:54
@Andarist Andarist changed the title Add select-mode, version, and publish sub-actions Add select-mode, version, pack and publish sub-actions Jun 20, 2026
Comment thread publish/action.yml Outdated
script:
description: "The command to use to publish packages"
required: false
packed-artifact-id:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a good input name? maybe pack-dir-artifact-id would be better?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're to keep this, I think pack-artifact-id is a bit nicer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with that too - I just thought about pack-dir-artifact-id as that would be symmetric~ with --from-pack-dir

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, in that case let's go with pack-dir-artifact-id then so it's consistent. Maybe we want to revisit the same naming for the publish plan too

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to revisit the same naming for the publish plan too

I thiiink that's already consistent enough - --from-plan/publish-plan-artifact-id. But I guess we could want to consistently use "publish plan" or just "plan" in both of those. I don't mind the current naming scheme but I would also be OK with adjusting it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I mean --from-plan could probably be --from-publish-plan, but it's kinda long. But, probably good to be explicit and it's not a common flag to manually use too

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I’m starting that rename here: changesets/changesets#2108

Comment thread src/run.ts
});
};

if (script) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note how with a custom publish script we don't handle fromPackDir at all. My best idea to handle this would be to also add support for passing this argument~ through CLI args. That way the scripts could forward env to the underlying changesets publish kinda naturally - without messing with flags forwarding. Thoughts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not relying on envs as it can be sometimes hard to follow who set what at when. Maybe we can support some sort of interpolation? Like script: pnpm format && pnpm changeset publish $action_args or ... publish --from-pack-dir $action_from_pack_dir. Just need to make sure to prevent potential script injections.

OR do we even need to allow specifying a script now? Since the sub-actions are explicit invocations now, if they need a pre-command or post-command, just do it in a pre-post-step. If they need a different version/publishing scheme, then don't call our action.

But I think what you have now is also fine and then we extend it later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OR do we even need to allow specifying a script now? Since the sub-actions are explicit invocations now, if they need a pre-command or post-command, just do it in a pre-post-step.

Yeah, I also wondered about that. Removing it would allow us to gather actual use cases for custom scripts before we re-commit to supporting them.

That said, it would break changesets/action's own publishing pipeline - or at least, it would make it more cumbersome~. But perhaps it wouldn't be too bad if only we'd expose changesets/action/github-release

@bluwy bluwy Jun 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For changesets/action, I think our publish script could be called directly like before without using the sub-action. For version though, I guess we need like a pre/post hook to make changes before we commit 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, we can stick to using the old root action - and figure this one later.

@socket-security

socket-security Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​actions/​artifact@​6.2.19810010088100

View full report

Comment thread src/pack/index.ts Outdated
@Andarist Andarist requested a review from beeequeue June 22, 2026 12:42
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.

2 participants