Skip to content

Commit

Permalink
fix(crud): Use abbreviations from config to derive change type from P…
Browse files Browse the repository at this point in the history
…R info (#58)

* use abbreviations from config to identify correct change type

* add changelog entry

* address linter
  • Loading branch information
MalteHerrmann committed Jul 27, 2024
1 parent 6a10498 commit 4d6c740
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ pub fn extract_pr_info(config: &Config, pr: &PullRequest) -> Result<PRInfo, GitH
.build()?
.captures(pr_title.as_str())
{
// TODO: adjust to reflect logic from PR #55
if let Some(ct) = i.name("ct") {
match ct.as_str() {
"fix" => 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);
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ pub fn get_description(default_value: &str) -> Result<String, InputError> {
}

pub fn get_pr_description() -> Result<String, InputError> {
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<Branch>) -> Result<String, InputError> {
Expand Down

0 comments on commit 4d6c740

Please sign in to comment.