Skip to content
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: add git-cliff GitHub integration #1305

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

orhun
Copy link
Sponsor Contributor

@orhun orhun commented Feb 26, 2024

This PR aims to bump git-cliff-core to the latest version to take advantage of the latest features: https://git-cliff.org/blog/2.0.0

There are a couple of todos that I want to resolve and I added comments regarding them. Mainly:

  • We need to call update_github_metadata function for the GitHub integration. I'm wondering if we already have access to GitHub PRs/commits at the point where this needs to be called.
  • There were some types which are almost identical to git-cliff-core definitions. I suggest we use them from upstream instead.

Also see: orhun/git-cliff#468 (I think it would be better if we can get a simple GitHub integration going without cache as the first step)

@@ -37,6 +37,7 @@ impl ChangelogCfg {
}

/// Used for modifying commit messages.
// TODO: why re-define this instead using it from git-cliff?
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Debug, Clone, JsonSchema)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these structs don't have all the derives release-plz needs. That's the main reason why I duplicated them.
E.g. TextProcessor has #[derive(Debug, Clone, Serialize, Deserialize)].
git-cliff TextProcessor has pattern: Regex, which makes it difficult to implement Eq for example.

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I'm down to implement the necessary traits for these types!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm down to implement the necessary traits for these types!

Definitely not urgent. Plus, there are some pros to have these structs in release-plz. E.g. I can document them in the context of release-plz and have the json schema update accordingly.

@MarcoIeni
Copy link
Owner

MarcoIeni commented Feb 27, 2024

I'm wondering if we already have access to GitHub PRs/commits at the point where this needs to be called.

No. We might have them when running release-plz release-pr, but we don't have them when we run release-plz update, so I suggest to keep the flow consistent among the two commands.

I think it would be better if we can get a simple GitHub integration going without cache as the first step

Yes 🚀

@orhun
Copy link
Sponsor Contributor Author

orhun commented Feb 28, 2024

I see, can you give me an example of how you retrieve the GitHub commits/PRs? I think then I can just map them to git-cliff-cores GitHubPullRequest/GitHubPullCommit type.

@MarcoIeni
Copy link
Owner

MarcoIeni commented Feb 29, 2024

I see, can you give me an example of how you retrieve the GitHub commits/PRs?

Here. However as I was saying this is only available in release-plz release-pr. Git-cliff should also work in release-plz update. Why do you want to map this PR to the GitCliff PR type? 🤔

EDIT: I realized that here I only parse the commits of the release PR itself. So to go back to your question:

I'm wondering if we already have access to GitHub PRs/commits at the point where this needs to be called.

Not at the moment. But we would need them to implement #1084

@orhun
Copy link
Sponsor Contributor Author

orhun commented Mar 21, 2024

I think it would be best to pair-program this when you have time 🐻

@MarcoIeni
Copy link
Owner

MarcoIeni commented Mar 22, 2024

Sure Orhun, let's do it!
I'm a bit busy in this period. I will DM you in the first week of April to find some time :)
We can also implement this live on YouTube as a coding in public experiment 👀

@orhun
Copy link
Sponsor Contributor Author

orhun commented Mar 22, 2024

Sounds awesome, let's do that!

@MarcoIeni
Copy link
Owner

In the meantime, we could upgrade to git-cliff-core 2 without the github feature, so that release-plz uses git-cliff latest version at least

@orhun orhun changed the title feat: bump git-cliff-core to v2 feat: add git-cliff GitHub integration Mar 24, 2024
@orhun
Copy link
Sponsor Contributor Author

orhun commented Mar 24, 2024

Sure, I did that in another PR (#1361) to not lose the discussion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants