Skip to content
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

Only create a relnotes tracking issue for finished FCPs if they have disposition merge #1904

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/handlers/relnotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct RelnotesState {
relnotes_issue: Option<u64>,
}

const TITLE_PREFIX: &str = "Tracking issue for release notes";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by refactoring to ensure that the two usage sites don't get out of sync.


pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
let Event::Issue(e) = event else {
return Ok(());
Expand All @@ -37,10 +39,7 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
return Ok(());
}

if e.issue
.title
.starts_with("Tracking issue for release notes")
{
if e.issue.title.starts_with(TITLE_PREFIX) {
// Ignore these issues -- they're otherwise potentially self-recursive.
return Ok(());
}
Expand All @@ -64,13 +63,14 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
}

if let IssuesAction::Labeled { label } = &e.action {
if ["relnotes", "relnotes-perf", "finished-final-comment-period"]
.contains(&label.name.as_str())
{
let title = format!(
"Tracking issue for release notes of #{}: {}",
e.issue.number, e.issue.title
);
let is_fcp_merge = label.name == "finished-final-comment-period"
&& e.issue
.labels
.iter()
.any(|label| label.name == "disposition-merge");

if label.name == "relnotes" || label.name == "relnotes-perf" || is_fcp_merge {
let title = format!("{TITLE_PREFIX} of #{}: {}", e.issue.number, e.issue.title);
let body = format!(
"
This issue tracks the release notes text for #{}.
Expand Down