auto icon indicating copy to clipboard operation
auto copied to clipboard

auto version skipRelease behaviour

Open Yeti-or opened this issue 2 years ago • 6 comments

I'm trying to release feature branch;

I have several pr-s in these branch, some of them are minors, some patches and some ci commits that should be skipped; I merged itб but auto decided to skip my release

Please help me understand this behaviour

My labels:

prLabels [
  [ 'plasma-infra', 'skip-release' ],
  [ 'skip-release' ],
  [ 'skip-release' ],
  [ 'skip-release' ],
  [ 'skip-release' ],
  [ 'minor' ],
  [ 'minor' ],
  [ 'plasma-infra', 'Hotfix', 'skip-release' ],
  [ 'patch' ],
  [ 'plasma-infra', 'skip-release' ],
  [ 'skip-release' ],
  [ 'skip-release' ],
  [ 'plasma-infra', 'skip-release' ],
  [ 'skip-release' ],
  [ 'skip-release' ],
  [ 'skip-release' ],
  [ 'minor' ],
  [ 'minor' ],
  [ 'skip-release' ]
]

yes the last pr to feature branch is CI related, but I don't understand why we should skip release if only last label is 'skip-release' ?

the code I am asking about:

https://github.com/intuit/auto/blob/main/packages/core/src/semver.ts#L221-L223

  const skipRelease = onlyPublishWithReleaseLabel
    ? !lastMergedCommitLabels.some((label) => releaseLabels.includes(label))
    : lastMergedCommitLabels.some((label) => skipReleaseLabels.includes(label));

I don't understand why lastMergedCommit is more important then all other commits

Environment Information:

"auto" version: v10.36.6
"git"  version: v2.32.1 (Apple Git-133)
"node" version: v14.21.2

Project Information:

✔ Repository:      salute-developers/plasma
✔ Author Name:     Vasiliy Loginevskiy
✔ Author Email:    [email protected]
✖ Current Version: v
✔ Latest Release:  @salutejs/[email protected]

✖ Labels configured on GitHub project (Try running "auto create-labels")

GitHub Token Information:

✔ Token:            [Token starting with 3b3d]
✖ Repo Permission:  read
✔ User:            Eva
✔ API:
✔ Enabled Scopes:   gist, notifications, repo, user, workflow, write:discussion, write:packages
✔ Rate Limit:       4447/5000

Additional context

I use conventional-commits plugin to calc version bump

Yeti-or avatar Jun 20 '23 14:06 Yeti-or

I'm pretty sure the behavior is to skip the release if the head commit has skip-release on it. Without that a release should have gone out

hipstersmoothie avatar Sep 10 '23 22:09 hipstersmoothie

I got stumped by this as well. I'm trying to write a simple plugin that filters out commits. If no commits are in scope, the version command should return empty (SEMVER.noVersion).

This seems to be impossible: If I use omitCommit and all commits are filtered out, auto uses the default label (patch) instead of noVersion. So I thought ok then let me use parseCommit and slap a skip-release label on those commits instead. But then I run into the same problem as stated here, where the input like labels: [ [ 'skip-release' ], [ 'skip-release' ], [ 'release-patch' ], [] ], causes the SEMVER.noVersion instead of patch.

restfulhead avatar Feb 12 '24 22:02 restfulhead

I haven't been in the code here for awhile. but we may have a default label? I'd be open to a tiny pr to enable your use case

hipstersmoothie avatar Feb 21 '24 19:02 hipstersmoothie

@hipstersmoothie I've made my use case work in my filter-by-workspace-path plugin by overwriting the release.getSemverBump function and just returning SEMVER.noVersion if there are no commits. I don't think this really solves @Yeti-or's issue though. However, if you think it's a useful patch, I'd be happy to open a PR with this change.

restfulhead avatar Feb 23 '24 22:02 restfulhead

That's creative! Would have never thought to do that. Kinda cool you can completely control that

Will have to think about if the patch makes sense

hipstersmoothie avatar Feb 23 '24 22:02 hipstersmoothie

That's creative! Would have never thought to do that. Kinda cool you can completely control that

Yeah, it does feel a bit hacky, but it works, hahah.

Btw, off-topic: I've just created an unrelated issue and PR for improving calcNextVersion, which I solved in a similar way. Would be nice if this could be merged, so that I could remove this workaround.

restfulhead avatar Feb 23 '24 22:02 restfulhead