-
-
Notifications
You must be signed in to change notification settings - Fork 255
feat(changelog): implement commit processing order as set of steps #1201
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,9 +82,54 @@ pub struct ChangelogConfig { | |
| pub output: Option<PathBuf>, | ||
| } | ||
|
|
||
| /// Processing steps for the commits | ||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| #[serde(rename_all = "snake_case")] | ||
| pub enum ProcessingStep { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestions:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thx for the suggestions, I think it is indeed nice to have consistent naming. However I think the naming is more a fundamental change as I am using the current naming definitions from the configuration (see https://git-cliff.org/docs/configuration/git). I can indeed modify the names with the caveat of using multiple names for the same (e.g.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, I think it makes more sense to use the names that we are already familiar. |
||
| /// Split commits on newlines, treating each line as an individual commit. | ||
| SplitCommits, | ||
| /// An array of regex based parsers to modify commit messages prior to | ||
| /// further processing. | ||
| CommitPreprocessors, | ||
| /// Try to parse commits according to the conventional commits | ||
| /// specification. | ||
| IntoConventional, | ||
| /// An array of regex based parsers for extracting data from the commit | ||
| /// message. | ||
| CommitParsers, | ||
| /// An array of regex based parsers to extract links from the commit message | ||
| /// and add them to the commit's context. | ||
| LinkParsers, | ||
| } | ||
|
|
||
| /// Processing order for the changelog. | ||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| pub struct ProcessingOrder { | ||
| /// The order in which the changelog should be processed. | ||
| pub order: Vec<ProcessingStep>, | ||
| } | ||
|
|
||
| impl Default for ProcessingOrder { | ||
| /// Returns the default processing order. | ||
| fn default() -> Self { | ||
| Self { | ||
| order: vec![ | ||
| ProcessingStep::CommitPreprocessors, | ||
| ProcessingStep::SplitCommits, | ||
| ProcessingStep::IntoConventional, | ||
| ProcessingStep::CommitParsers, | ||
| ProcessingStep::LinkParsers, | ||
| ], | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// Git configuration | ||
| #[derive(Debug, Default, Clone, Serialize, Deserialize)] | ||
| pub struct GitConfig { | ||
| /// Defines the processing order of the commits. | ||
| #[serde(default)] | ||
| pub processing_order: ProcessingOrder, | ||
| /// Parse commits according to the conventional commits specification. | ||
| pub conventional_commits: bool, | ||
| /// Require all commits to be conventional. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
A thing to keep in mind is that if all the steps are not listed in the
processing_orderthey will be skipped. So maybe we need to check that the list always contains all the steps (no matter the order)