-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Idea: detect next SemVer automatically by categories #902
Comments
Good day @ccremer You are absolutely right that the action practically already has all the information to make such a decisions. Right now the action was kept very specifically on the task of creating changelogs, excluding functionality like creating a release for example. These decisions were made to keep the action easier maintainable and there are already a ton of great actions out there doing these things. Looking briefly into your source it looks that most of it seems to be handled by the SemVer plugin, but I am not sure how well that will hold up for more complex situations like pre-releases as you described? So I was thinking on alternative ideas, but they also have downsides. For example this action could return the categories it collected and a step afterwards could parse this information to detect the next release version. The major downside is that the This could allow to create the action deciding on the next version very precisely for that usecase (so it could even be used beyond that in other usecases) - while still keeping the changelog-builder focused on building the changelog. |
Hi. The alternative idea to put the categories into the output sounds okay to me. Technically, at least for the figuring out the next SemVer, it should be sufficient to have only a count of PRs for each category, But maybe it's better to put more meta information into it.
Hm, yes. Not sure about dealing with that.
It's probably enough to put a special placeholder into the TO_TAG placeholder, so it can be replaced in the changelog by another step ( |
@ccremer having this orchestration acts like an It would actually be interesting to invoke an action as part of an action, like Returning as a json sounds more clever than "just" a comma separated list of which categories have been found. For the placeholder, I think it's possibly edge-case enough whereas a |
Yes I agree with the add-on bit.
I think we don't need to put in PRs with the full metadata, maybe just selected properties like ID, PR number. Maybe labels and author, but that's about it. It's enough so that a follow-up action /add-on can invoke the API again if needed. For figuring out the next semver as an add-on though, they're not required. If we consider the next-semver-detecting as an add-on as "agreed upon", how should we continue here? (I might not be as fast as I'd like, since I'm still just learning TypeScript atm.) |
We are kind of doing this already with the help of couple simple actions/steps:
This works nicely when there are only 2 levels i.e. minor / patch that you want to automate, but if you want major as well it would need another step or at least could not find nice 'switch/case' type of action with multiple conditions. |
I believe with: #1132 landing, we can close this as complete? |
Available in v4 (v4.0.0-b01) |
Context
I'm now well accustomed to categorizing PRs into Features, Bugfixes or documentation when authoring them. For example:
PRs labelled as "bugfix" or "dependency" always get a Patch release version increment (e.g.
v1.2.3
tov1.2.4
).PRs labelled as "feature" always get a Minor release version increment (e.g.
v1.2.3
tov1.3.0
).PRs labelled as "breaking" get a Major release version increment (
v1.2.3
tov2.0.0
).Problem
After merging a bunch of them, when creating a new release, I have to manually go over the merged PRs to figure out the next version according to SemVer and make an accordingly git tag. The category with the "highest increment policy" wins if even 1 PR is in there. For example, there could be 100 bugfixes since the last release version and it would be just a new Patch release, but if even 1 feature PR is in the list, then SemVer dictates a Minor release.
Solution idea
What if this action can actually figure out the next release version by itself? All the information is there.
toTag
is empty (or some other property saying "figure it out by PR labels"), then the action determines the next release version after categorizing the PRs.on: workflow_dispatch
, e.g. through GitHub browser or through other means than pushing a git tag.Alternative
I have started to create my own action (https://github.com/ccremer/auto-detect-semver-action/tree/initial) inspired by yours, even sharing the same configuration.json with the added increment policy. But when I realized I could almost use the same code (get the PRs, categorize them, etc) as this action, I started to import that in the package.json.
Eventually I thought to discuss it here, whether it would make sense to add this functionality to this action. Technically this would avoid fetching and categorizing PRs twice in the same workflow. I would be willing to fork and contribute such a feature if you'd accept it.
Footnotes
incrementPrelease
istrue
then the action would, iffromTag
contains a prerelease likev1.2.0-rc1
, increment tov1.2.0-rc2
0.1.0
.The text was updated successfully, but these errors were encountered: