From 20d64cfcfc5712ca7d5a29e72f5293141c3b269e Mon Sep 17 00:00:00 2001 From: MalteHerrmann Date: Sat, 27 Jul 2024 23:30:45 +0200 Subject: [PATCH 1/3] use abbreviations from config to identify correct change type --- src/github.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/github.rs b/src/github.rs index 65c1b34..cb061db 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 = name.to_owned(); } }; From 208973dcedd452c945cfc045950dce5194887135 Mon Sep 17 00:00:00 2001 From: MalteHerrmann Date: Sat, 27 Jul 2024 23:38:14 +0200 Subject: [PATCH 2/3] add changelog entry --- CHANGELOG.md | 4 ++++ src/inputs.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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/inputs.rs b/src/inputs.rs index cc615aa..1a8ba51 100644 --- a/src/inputs.rs +++ b/src/inputs.rs @@ -40,7 +40,7 @@ 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.") + Editor::new("Please provide the Pull Request body with a description of the made changes.\n") .prompt()?, ) } From 74ca9e8ddeb3a08004a4523dd4c95c90f4e5c156 Mon Sep 17 00:00:00 2001 From: MalteHerrmann Date: Sat, 27 Jul 2024 23:39:19 +0200 Subject: [PATCH 3/3] address linter --- src/github.rs | 2 +- src/inputs.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/github.rs b/src/github.rs index cb061db..c8b3ddc 100644 --- a/src/github.rs +++ b/src/github.rs @@ -34,7 +34,7 @@ pub fn extract_pr_info(config: &Config, pr: &PullRequest) -> Result Result { } pub fn get_pr_description() -> Result { - Ok( - Editor::new("Please provide the Pull Request body with a description of the made changes.\n") - .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 {