diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b17bbe..345f1d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ [Issue #138]: https://github.com/chenxiaolong/avbroot/issues/138 [Issue #144]: https://github.com/chenxiaolong/avbroot/issues/144 [Issue #145]: https://github.com/chenxiaolong/avbroot/issues/145 [Issue #148]: https://github.com/chenxiaolong/avbroot/issues/148 -[PR #130 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/130 -[PR #132 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/132 -[PR #135 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/135 -[PR #136 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/136 -[PR #137 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/137 -[PR #139 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/139 -[PR #140 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/140 -[PR #146 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/146 -[PR #147 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/147 -[PR #149 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/149 -[PR #150 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/150 -[PR #152 @chenxiaolong]: https://github.com/chenxiaolong/avbroot/pull/152 +[PR #130]: https://github.com/chenxiaolong/avbroot/pull/130 +[PR #132]: https://github.com/chenxiaolong/avbroot/pull/132 +[PR #135]: https://github.com/chenxiaolong/avbroot/pull/135 +[PR #136]: https://github.com/chenxiaolong/avbroot/pull/136 +[PR #137]: https://github.com/chenxiaolong/avbroot/pull/137 +[PR #139]: https://github.com/chenxiaolong/avbroot/pull/139 +[PR #140]: https://github.com/chenxiaolong/avbroot/pull/140 +[PR #146]: https://github.com/chenxiaolong/avbroot/pull/146 +[PR #147]: https://github.com/chenxiaolong/avbroot/pull/147 +[PR #149]: https://github.com/chenxiaolong/avbroot/pull/149 +[PR #150]: https://github.com/chenxiaolong/avbroot/pull/150 +[PR #152]: https://github.com/chenxiaolong/avbroot/pull/152 diff --git a/xtask/src/changelog.rs b/xtask/src/changelog.rs index 2e77660..44c0984 100644 --- a/xtask/src/changelog.rs +++ b/xtask/src/changelog.rs @@ -20,16 +20,11 @@ use crate::WORKSPACE_DIR; struct LinkRef { link_type: String, number: u32, - user: Option, } impl fmt::Display for LinkRef { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "[{} #{}", self.link_type, self.number)?; - if let Some(u) = &self.user { - write!(f, " @{}", u)?; - } - write!(f, "]") + write!(f, "[{} #{}]", self.link_type, self.number) } } @@ -55,7 +50,7 @@ fn check_brackets(line: &str) -> Result<()> { fn update_changelog_links(path: &Path, base_url: &str) -> Result<()> { let re_standalone_link = Regex::new(r"\[([^\]]+)\]($|[^\(\[])")?; - let re_auto_link = Regex::new(r"^(Issue|PR) #([0-9]+)(?: @([a-zA-Z0-9\-]+))?$")?; + let re_auto_link = Regex::new(r"^(Issue|PR) #([0-9]+)?$")?; let mut links = BTreeMap::::new(); let raw_reader = File::open(path)?; @@ -85,22 +80,11 @@ fn update_changelog_links(path: &Path, base_url: &str) -> Result<()> { let link_ref = captures.get(0).unwrap().as_str(); let link_type = captures.get(1).unwrap().as_str(); let number: u32 = captures.get(2).unwrap().as_str().parse()?; - let user = captures.get(3).map(|c| c.as_str()); let link = match link_type { - "Issue" => { - if user.is_some() { - bail!("{link_ref} should not have a username"); - } - format!("{base_url}/issues/{number}") - } - "PR" => { - if user.is_none() { - bail!("{link_ref} should have a username"); - } - format!("{base_url}/pull/{number}") - } - t => bail!("Unknown link type: {t:?}"), + "Issue" => format!("{base_url}/issues/{number}"), + "PR" => format!("{base_url}/pull/{number}"), + t => bail!("Unknown link type in {link_ref:?}: {t:?}"), }; // #0 is used for examples only. @@ -109,7 +93,6 @@ fn update_changelog_links(path: &Path, base_url: &str) -> Result<()> { LinkRef { link_type: link_type.to_owned(), number, - user: user.map(|u| u.to_owned()), }, link, );