Skip to content
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
41 changes: 20 additions & 21 deletions src/handlers/autolabel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ pub(super) async fn parse_input(
}
}

if let Some(files) = &files {
// This a PR.

// Add the matching labels for the modified files paths
if cfg
.trigger_files
.iter()
.any(|f| files.iter().any(|file_diff| file_diff.path.starts_with(f)))
{
autolabels.push(Label {
name: label.to_owned(),
});
if event.issue.is_pr() {
if let Some(files) = &files {
// This a PR with modified files.

// Add the matching labels for the modified files paths
if cfg
.trigger_files
.iter()
.any(|f| files.iter().any(|file_diff| file_diff.path.starts_with(f)))
{
autolabels.push(Label {
name: label.to_owned(),
});
}
}

// Treat the following situations as a "new PR":
Expand All @@ -106,15 +108,12 @@ pub(super) async fn parse_input(
});
state.data.new_pr_labels_applied = true;
}
}

if event.issue.pull_request.is_none()
&& cfg.new_issue
&& event.action == IssuesAction::Opened
{
autolabels.push(Label {
name: label.to_owned(),
});
} else {
if cfg.new_issue && event.action == IssuesAction::Opened {
autolabels.push(Label {
name: label.to_owned(),
});
}
}
}

Expand Down
Loading