Skip to content

Commit e1da5eb

Browse files
committed
add has_label helper
1 parent 0bcf594 commit e1da5eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

mdbook-goals/src/gh/issues.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ impl ExistingGithubIssue {
237237
pub fn was_locked(&self) -> bool {
238238
self.comments.iter().any(|c| c.body.trim() == LOCK_TEXT)
239239
}
240+
241+
/// True if we have a label with the given name.
242+
pub fn has_label(&self, name: &str) -> bool {
243+
self.labels.iter().any(|label| label.name == name)
244+
}
240245
}
241246

242247
pub fn lock_issue(repository: &Repository, number: u64) -> anyhow::Result<()> {

mdbook-goals/src/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn try_checkboxes(issue: &ExistingGithubIssue) -> anyhow::Result<Progress> {
225225
}
226226

227227
fn is_flagship(issue: &ExistingGithubIssue) -> bool {
228-
issue.labels.iter().any(|label| label.name == "flagship")
228+
issue.has_label("flagship")
229229
}
230230

231231
fn updates(comments: Vec<ExistingGithubComment>) -> Vec<TrackingIssueUpdate> {

0 commit comments

Comments
 (0)