-
-
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
fix(changelog): fix previous version links #364
fix(changelog): fix previous version links #364
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #364 +/- ##
==========================================
- Coverage 42.73% 41.98% -0.75%
==========================================
Files 13 13
Lines 667 679 +12
==========================================
Hits 285 285
- Misses 382 394 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Note the first pipeline run is on purpose, and follows a TDD approach, so that we can see the current failing scenarios. |
b333bd8
to
a6f36fc
Compare
Hey, thanks for creating this! 🐻 I didn't quite get which issue this PR is solving. Can you elaborate what's the problem before and what was your approach for solving it? Giving example input/output would be really helpful since it is kind of difficult to infer it from the code. |
Sure With the current code before the PR with the following commits GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1"
git tag v0.1.0
GIT_COMMITTER_DATE="2021-01-24 01:23:46" git commit --allow-empty -m "feat: add feature 2"
git tag v0.2.0 Running
will result in a scenario where we won't have a previous version correctly set for v0.2.0. (you can check this here https://github.com/orhun/git-cliff/actions/runs/7075903455/job/19258554935#step:3:569) After this PR this is correctly fixed and the previous tag v0.1.0 is set. (you can check it here https://github.com/orhun/git-cliff/actions/runs/7076145622/job/19259077413#step:3:573) Ty, if you need something else ping me :) |
Also a bit more in detail on the approach to solve the previous links in a uniform approach. The idea was the following:
|
Btw just merged with latest changes on main. If you need I can rebase everything to avoid the merge commit (I guess that if you are using squash you don't need it, but please do tell me if it is required). |
I think there is a general confusion about the usage of Also see #37 for the implementation details. So in your case, if you want the previous release to be set, you can simply use $ git cliff --context --latest | jq .[].previous
{
"version": "v0.1.0",
"commits": [],
"commit_id": "0b5b2e2cb8c5e921e1c34b0ba60e442255d2a659",
"timestamp": 0,
"previous": null
} I hope this helps, let me know! I think I can update the docs about clarifying the usage of |
ping 🐻 |
Hey hey sorry for the delayed response. Okay so let me use this example suppose that I have 3 tags v1.0.0 And now at this moment I'm on tag v3.0.0. What is the previous version of v3.0.0? It's v2.0.0 From what I got If I use |
I think there is a misunderstanding. What I'm saying is simply there is no need to use However, if you check out |
.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml
Outdated
Show resolved
Hide resolved
Sorry for the delay on the response. I've tried to be thorough and did a in depth analysis to check that I didn't messed up anything. I've documented it here https://github.com/tvcsantos/git-cliff-test. And yes the PR is fixing the last issue you mentioned and with that also makes the code uniform for all cases, without requiring special ifs and the cumbersome check for tag lens. Extracting the example from my test that is it: diff --color -r results/1_4_0/at_2_0_0/context/current.json results/new/at_2_0_0/context/current.json
31c31
< "version": null,
---
> "version": "v1.0.0",
33c33
< "commit_id": null,
---
> "commit_id": "fa211a975e7c2a60053561e45660b0c57b847c72",
diff --color -r results/1_4_0/at_2_0_0/render/current.md results/new/at_2_0_0/render/current.md
1c1
< ## [2.0.0](https://github.com/tvcsantos/git-cliff-test/releases/tag/v2.0.0) - 2023-12-08
---
> ## [2.0.0](https://github.com/tvcsantos/git-cliff-test/compare/v1.0.0...v2.0.0) - 2023-12-08 |
That's nice! I guess we can confirm that the behavior isn't changed from the fixture tests as well. |
There are some conflicts with |
All updated and merged with the last changes from main. Ty 💚 |
All seems good except for the failing "Continuous Integration / Links (pull_request)" that I think is not related. I've checked the failure and the links seem correct on the CHANGELOG 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last comment 🐻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! 💖
Description
In this PR the main goal was to simplify and fix the previous version links on all scenarios.
Motivation and Context
There were some scenarios where the previous version link was incorrect. For example
was producing the wrong link for the current tag, considering it as the only release.
How Has This Been Tested?
Created several extra tests for fixtures to address the several combinations and provide a strong test suite to avoid regressions further on the line.
Screenshots / Logs (if applicable)
Types of Changes
Checklist: