-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
--bumped-version
fails if commit is skipped by commit_parsers
#816
Comments
Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️ |
Hello 👋🏼 thanks for the issue, I reproduced this with a minimal example and it seems like the correct behavior. However, I agree that the warning message is a bit misleading in this case.
Can you expand this a bit? I would like to better understand your use case to find a middleground here and potentially change the behavior. Are you using |
Yes, and I thought that was intended as a feature :) Here is the github actions workflow I use to create an automated "bump the version" PR, e.g. this one: colinmarc/magic-mirror#12 I'm using |
Thanks for sharing your use case, it's all clear now 🙂
I see why that happens: git-cliff/git-cliff/src/lib.rs Line 603 in c34aaa0
Maybe we can change this behavior a bit and use exit codes instead - that would make the integration easier I reckon. This way we also don't need to change the output and just get away with a better warning message. Needs a bit more thought maybe. What do you think? |
While a different exit code would be more explicit, it wouldn't actually solve this issue. Said another way, I would like this sequence of commits to report a (correct) bump:
I would like |
Yeah, that sounds correct. However, not sure if that's the same as the first issue you've described. I tried to reproduce with the following configuration and commit history: # cliff.toml
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "build", skip = true },
]
And it works fine:
Not sure if I'm missing something here, can you take a look? 👀 |
I took a fresh look. I think you're right, and I got confused in my last message. The issue is indeed being able to reliably detect whether a version bump is necessary at all, and exit codes would help. Details:
At that commit, the last version of the server was 0.4.1, and there have only been build commits since then:
But I get
I'm a little bit confused about whether the If I add a fix commit, it starts working as expected:
I actually can't figure out how to get it to exit without printing anything now 😓 . I was using that behavior at some point, though. So, long story short, yes, exit codes would solve my problem. |
By the way, not sure if this is a separate issue, but I need to use |
Let's take a step back and try to identify the issues that we are having first. I feel like we are describing a new/different issue with each comment. 1. git init
git commit --allow-empty -m "build: foo"
git commit --allow-empty -m "build: bar"
git tag v1.2.3
git commit --allow-empty -m "fix: baz" git cliff --bumped-version # v1.2.4 ✅
git cliff -u --bumped-version # v1.2.4 ✅ 2. git init
git commit --allow-empty -m "build: foo"
git commit --allow-empty -m "build: bar"
git tag v1.2.3
git commit --allow-empty -m "build: baz" [git]
commit_parsers = [
{ message = "build", skip = true }
] git cliff --bumped-version # v0.1.0 ❌
git cliff -u --bumped-version # v0.1.0 ❌ 3. git init
git commit --allow-empty -m "build: foo"
git commit --allow-empty -m "fix: bar"
git tag v1.2.3
git commit --allow-empty -m "build: baz" [git]
commit_parsers = [
{ message = "build", skip = true }
] git cliff --bumped-version # v1.2.3 🤔 (there is nothing to bump)
git cliff -u --bumped-version # v0.1.0 ❌ 4. git init
git commit --allow-empty -m "build: foo"
git commit --allow-empty -m "fix: bar"
git tag v1.2.3 git cliff --bumped-version # v1.2.3 🤔 (there is nothing to bump)
git cliff -u --bumped-version # v0.1.0 ❌ And yes, I also can't figure out how to get it to exit without printing anything... Can you take a look again and help me with that and also identify which one you are currently hitting? |
Thanks for all your time and attention on this, and sorry it's so convoluted. The issue at hash Just to repeat the git history at that point:
And the output: % git cliff --bumped-version --tag-pattern "server" -c .github/workflows/cliff.toml # mmserver-v0.4.1 🤔 (there is nothing to bump)
% git cliff --bumped-version --tag-pattern "server" --unreleased -c .github/workflows/cliff.toml # 0.1.0 ❌ In your version 2, you get 0.1.0 for both, whereas I get 🤔 without |
Yeah I agree, there might be other things that are affecting the output here. We can come back to those details later on.
So should we return something else or nothing in that case? Also using exit codes would be nice I guess. |
I think the two best options (other than exit codes) are either the empty string or the current latest version. The empty string is reasonably communicative, especially if it's accompanied by a |
Sounds reasonable. I just realized something, you can actually achieve this when #859 goes out, you simply need to add So 2 becomes: git init
git commit --allow-empty -m "build: foo"
git commit --allow-empty -m "build: bar"
git tag v1.2.3
git commit --allow-empty -m "build: baz" [git]
commit_parsers = [
{ message = "build", skip = true }
]
[changelog]
always_render = true
Can you test it out? It works because Not sure if that solution fits the description of this issue but... yeah. |
Yeah, that works!
|
Awesome! Do you think the name of the option is intuitive? I think I'm going to yolo that for the next release :) |
Btw I renamed it to |
Hm, I guess from my perspective it's changing something unrelated to If I was naming it, I'd probably go with |
I use
git-cliff
both for generating changelogs and detecting the next version, with--bumped-version
. Here is my config:Unfortunately, setting
skip = true
onbuild:
commits seems to cause--bumped-version --unreleased
to fail if the latest tag points to a build commit, presumably because it's skipping over that commit.For example, on d888ab of https://github.com/colinmarc/magic-mirror:
I'm not sure what the right behavior is, here. Ideally, I'd like to skip those commits for the purpose of determining whether the version should be bumped, but not fail if there are legitimate changes since a tagged
build:
version.In other words, on the following history:
Then I would like
--bumped-version --unreleased
to return an empty string, as it currently does if the tag points to a non-skipped commit, like so:The text was updated successfully, but these errors were encountered: