Skip to content

Commit

Permalink
tasks/eval: label package updates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cole-h committed May 25, 2020
1 parent fd1b796 commit 01ada53
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions ofborg/src/tasks/eval/nixpkgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ impl<'a> NixpkgsStrategy<'a> {
}
}

/// Takes a list of commit messages and checks if any of them contains the
/// standard version bump indicator, `->`; if any do, the `8.has: package
/// (update)` label is added.
fn tag_from_commits(&self, msgs: &[String]) {
for msg in msgs {
if msg.contains("->") {
update_labels(
&self.issue_ref,
&[String::from("8.has: package (update)")],
&[],
);
}
}
}

fn check_stdenvs_before(&mut self, dir: &Path) {
let mut stdenvs = Stdenvs::new(self.nix.clone(), dir.to_path_buf());
stdenvs.identify_before();
Expand Down Expand Up @@ -379,13 +394,15 @@ impl<'a> EvaluationStrategy for NixpkgsStrategy<'a> {
let changed_paths = co
.files_changed_from_head(&self.job.pr.head_sha)
.unwrap_or_else(|_| vec![]);
self.changed_paths = Some(changed_paths);
let commit_messages = co
.commit_messages_from_head(&self.job.pr.head_sha)
.unwrap_or_else(|_| vec!["".to_owned()]);

self.tag_from_paths();
self.tag_from_commits(&commit_messages);

self.touched_packages = Some(parse_commit_messages(
&co.commit_messages_from_head(&self.job.pr.head_sha)
.unwrap_or_else(|_| vec!["".to_owned()]),
));
self.changed_paths = Some(changed_paths);
self.touched_packages = Some(parse_commit_messages(&commit_messages));

Ok(())
}
Expand Down

0 comments on commit 01ada53

Please sign in to comment.