Merge pull request #60 from NixOS/dont-auto-build-wips
Dont auto build wips
This commit is contained in:
commit
231d2f15cc
14
README.md
14
README.md
|
@ -9,17 +9,23 @@
|
|||
|
||||
## Automatic Building
|
||||
|
||||
Users who are _trusted_ (see: ./config.public.json) will have their
|
||||
PRs automatically trigger builds if their commits follow the
|
||||
well-defined format of Nixpkgs. Example messages and the builds:
|
||||
Users who are _trusted_ (see: ./config.public.json) or _known_ (see:
|
||||
./config.known-users.json) will have their PRs automatically trigger
|
||||
builds if their commits follow the well-defined format of Nixpkgs.
|
||||
Example messages and the builds:
|
||||
|
||||
|Message|Automatic Build|
|
||||
|-|-|
|
||||
|`vim: 1.0.0 -> 2.0.0`|`vim`|
|
||||
|`python3Packages.requests,python2Packages.requests: 1.0.0 -> 2.0.0`|`python3Packages.requests`, `python2Packages.requests`|
|
||||
|`python36Packages.requests,python27Packages.requests: 1.0.0 -> 2.0.0`|`python36Packages.requests`, `python27Packages.requests`|
|
||||
|`python{2,3}Packages.requests: 1.0.0 -> 2.0.0`|_nothing_|
|
||||
|
||||
If a PR is opened with many commits, it will create a single build job
|
||||
for all of the detected packages. If a PR is opened and many commits
|
||||
are pushed one by one to the open PR, many build jobs will be created.
|
||||
|
||||
To disable automatic building of packages on a PR, add `[WIP]` to the
|
||||
PR's title, or the `2.status: work-in-progress` label.
|
||||
|
||||
## Commands
|
||||
|
||||
|
|
|
@ -118,11 +118,15 @@ impl<E: stats::SysEvents> worker::SimpleWorker for MassRebuildWorker<E> {
|
|||
return self.actions().skip(&job);
|
||||
}
|
||||
|
||||
if issue_is_wip(&iss) {
|
||||
auto_schedule_build_archs = vec![];
|
||||
} else {
|
||||
auto_schedule_build_archs = self.acl.build_job_destinations_for_user_repo(
|
||||
&iss.user.login,
|
||||
&job.repo.full_name,
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
self.events.tick("issue-fetch-failed");
|
||||
info!("Error fetching {}!", job.pr.number);
|
||||
|
@ -765,3 +769,29 @@ mod tests {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn issue_is_wip(issue: &hubcaps::issues::Issue) -> bool {
|
||||
if issue.title.contains("[WIP]") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if issue.title.starts_with("WIP:") {
|
||||
return true;
|
||||
}
|
||||
|
||||
issue.labels.iter().any(|label| indicates_wip(&label.name))
|
||||
}
|
||||
|
||||
fn indicates_wip(text: &str) -> bool {
|
||||
let text = text.to_lowercase();
|
||||
|
||||
if text.contains("work in progress") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if text.contains("work-in-progress") {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue