Watch
0
0
Fork
You've already forked hyperhive
0

an agent gets one todo when its pr starts conflicting with the target branch

This commit is contained in:
atlas 2026-11-11 04:36:28 +01:00 • committed by mara
commit 11eb7dac9c

View file

@ -0,0 +1,42 @@
//! The open pull requests that target one branch.
use anyhow::{Context, Result};
use forgejo_api::structs::{
PullRequest, RepoListPullRequestsQuery, RepoListPullRequestsQueryState,
};
use super::Client;
impl Client {
/// Every open pull request in `owner/repo` whose target branch is `base`,
/// as the forge lists them: one call per page of 50.
///
/// # Errors
///
/// The forge refused or did not answer.
pub async fn open_pulls_on(
&self,
owner: &str,
repo: &str,
base: &str,
) -> Result<Vec<PullRequest>> {
let query = RepoListPullRequestsQuery {
state: Some(RepoListPullRequestsQueryState::Open),
sort: None,
milestone: None,
labels: None,
poster: None,
base: Some(base.to_owned()),
head: None,
};
self.api
.call(|api| {
Box::pin(
api.repo_list_pull_requests(owner, repo, query.clone())
.all(),
)
})
.await
.with_context(|| format!("list open pull requests on {base} in {owner}/{repo}"))
}
}