diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e1953..76a48dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ This changelog was created using the `clu` binary - (crud) [#48](https://github.com/MalteHerrmann/changelog-utils/pull/48) Use authenticated requests when checking open PRs. - (config) [#51](https://github.com/MalteHerrmann/changelog-utils/pull/51) Get available configuration from existing changelog during initialization. +### Bug Fixes + +- (crud) [#58](https://github.com/MalteHerrmann/changelog-utils/pull/58) Use abbreviations from config to derive change type from PR info. + ## [v1.1.2](https://github.com/MalteHerrmann/changelog-utils/releases/tag/v1.1.2) - 2024-06-30 ### Bug Fixes diff --git a/src/github.rs b/src/github.rs index 65c1b34..c8b3ddc 100644 --- a/src/github.rs +++ b/src/github.rs @@ -28,13 +28,13 @@ pub fn extract_pr_info(config: &Config, pr: &PullRequest) -> Result change_type = "Bug Fixes".to_string(), - "imp" => change_type = "Improvements".to_string(), - "feat" => change_type = "Features".to_string(), - _ => (), + if let Some((name, _)) = config + .change_types + .iter() + .find(|&(_, abbrev)| abbrev.eq(ct.into())) + { + change_type.clone_from(name); } }; diff --git a/src/inputs.rs b/src/inputs.rs index cc615aa..d0b63ad 100644 --- a/src/inputs.rs +++ b/src/inputs.rs @@ -39,10 +39,10 @@ pub fn get_description(default_value: &str) -> Result { } pub fn get_pr_description() -> Result { - Ok( - Editor::new("Please provide the Pull Request body with a description of the made changes.") - .prompt()?, + Ok(Editor::new( + "Please provide the Pull Request body with a description of the made changes.\n", ) + .prompt()?) } pub fn get_target_branch(branches_page: Page) -> Result {