-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
feat: automatically set git-cliff remote from git remote #1571
feat: automatically set git-cliff remote from git remote #1571
Conversation
Thanks! Can you update release-plz docs here https://release-plz.ieni.dev/docs/changelog-format#context ? |
I've added a little bit of documentation! Hopefully, that's sufficient 😅 |
@@ -205,6 +216,27 @@ impl Update { | |||
.try_into() | |||
.context("invalid `[changelog] config")? | |||
}; | |||
if let Some(remote) = upstream_remote { | |||
// This matches https://github.com/orhun/git-cliff/blob/e7807e13c4b38aaa4a735ff05b69fdd6b57a7a85/git-cliff/src/lib.rs#L117 | |||
// even though it will only set the first unset remote |
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.
Hey, I now have some time to look into this!
First, with this code, will this ever work with anything other than github?
Have you tested this PR? I don't think we have remote git-cliff features enabled, so even if I merge this, is this going to work?
Also, the release-plz changelog configuration doesn't let you set the remote.
This will work only if you use the changelog_config field which is deprecated.
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.
I tried this approach, that autodetects the remote.
Of course git-cliff does more than that, because it also detects the contributors.
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.
Hi!
First, with this code, will this ever work with anything other than github?
I essentially copied what git-cliff does in the link in the comment above, so it'll match the behaviour exactly. My reading of the code is that it sets the first unset option, although I haven't tested it in depth. This probably isn't the user-expected behaviour, though!
Have you tested this PR? I don't think we have remote git-cliff features enabled, so even if I merge this, is this going to work?
I tested it on one of my repositories, yes. I just wanted the remote.github.owner
and remote.github.repo
context fields to be set, so I could template links to the repo. And you're right, no optional git-cliff-core features are enabled, so no actual data about the remotes is filled in, although it would be automatically if those features were enabled.
the changelog_config field which is deprecated
I didn't know that it was depreciated! I use it, if just to separate things a bit, so it's good to know
I tried #1575 approach, that autodetects the remote.
That solves my use case, thank you! The remote.link
field is especially helpful 😄
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.
What are you using the link for? If it's for the release link (i.e. the tag comparison) release-plz adds it already in the context!
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.
I was using it to generate a link to each commit (like [`{{ commit.id | truncate(length=7, end="") }}`]({{ self::remote_url() }}/commit/{{ commit.id }})
to get 21c51b9
)
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.
Cool! 😁
I'll try to get my pr merged next week 👍
That pr is now released 👍 |
This automatically sets git cliff's
config.remote.*.owner
/.repo
, so that it matches the git-cliff CLI behavior and more of git-cliff's example templates work by default.