Skip to content

Commit 01ada53

Browse files
committed
tasks/eval: label package updates
Package version updates that follow the well-established and widely-used commit message format of `attr: 1.0.0 -> 2.0.0` will now be labeled with the `8.has: package (update)` label. Only ASCII arrows (e.g. `->`) are accepted -- Unicode arrows will not trigger the addition of this label.
1 parent fd1b796 commit 01ada53

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

ofborg/src/tasks/eval/nixpkgs.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,21 @@ impl<'a> NixpkgsStrategy<'a> {
101101
}
102102
}
103103

104+
/// Takes a list of commit messages and checks if any of them contains the
105+
/// standard version bump indicator, `->`; if any do, the `8.has: package
106+
/// (update)` label is added.
107+
fn tag_from_commits(&self, msgs: &[String]) {
108+
for msg in msgs {
109+
if msg.contains("->") {
110+
update_labels(
111+
&self.issue_ref,
112+
&[String::from("8.has: package (update)")],
113+
&[],
114+
);
115+
}
116+
}
117+
}
118+
104119
fn check_stdenvs_before(&mut self, dir: &Path) {
105120
let mut stdenvs = Stdenvs::new(self.nix.clone(), dir.to_path_buf());
106121
stdenvs.identify_before();
@@ -379,13 +394,15 @@ impl<'a> EvaluationStrategy for NixpkgsStrategy<'a> {
379394
let changed_paths = co
380395
.files_changed_from_head(&self.job.pr.head_sha)
381396
.unwrap_or_else(|_| vec![]);
382-
self.changed_paths = Some(changed_paths);
397+
let commit_messages = co
398+
.commit_messages_from_head(&self.job.pr.head_sha)
399+
.unwrap_or_else(|_| vec!["".to_owned()]);
400+
383401
self.tag_from_paths();
402+
self.tag_from_commits(&commit_messages);
384403

385-
self.touched_packages = Some(parse_commit_messages(
386-
&co.commit_messages_from_head(&self.job.pr.head_sha)
387-
.unwrap_or_else(|_| vec!["".to_owned()]),
388-
));
404+
self.changed_paths = Some(changed_paths);
405+
self.touched_packages = Some(parse_commit_messages(&commit_messages));
389406

390407
Ok(())
391408
}

0 commit comments

Comments
 (0)