leave an agent with no config commit out of internal/meta; read config heads from main
on deploy, one agent whose agent-configs repo has no commit on main is skipped and logged instead of failing the whole internal/meta render, so the other agents' pin moves go through. the controller reads each config head from main, the branch hive-c0re compares against, not the repo's default branch.
This commit is contained in:
parent
4697740a7e
commit
bbc6174361
1 changed files with 90 additions and 24 deletions
|
|
@ -158,8 +158,8 @@ pub struct PullForReview {
|
|||
pub narrowed: Option<String>,
|
||||
}
|
||||
|
||||
/// Files on a repo's default branch, as [`Client::default_branch_files`] reads
|
||||
/// them.
|
||||
/// Files on a repo's branch, as [`Client::default_branch_files`] and
|
||||
/// [`Client::branch_files`] read them.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct DefaultBranchFiles {
|
||||
pub branch: String,
|
||||
|
|
@ -1444,6 +1444,21 @@ impl Client {
|
|||
owner: &str,
|
||||
repo: &str,
|
||||
paths: &[&str],
|
||||
) -> Result<Option<DefaultBranchFiles>> {
|
||||
self.branch_files(owner, repo, None, paths).await
|
||||
}
|
||||
|
||||
/// [`Self::default_branch_files`] on `branch`, the default branch when it is
|
||||
/// `None`. `None` as well when the branch has no commit.
|
||||
///
|
||||
/// # Errors
|
||||
/// As [`Self::default_branch_files`].
|
||||
pub async fn branch_files(
|
||||
&self,
|
||||
owner: &str,
|
||||
repo: &str,
|
||||
branch: Option<&str>,
|
||||
paths: &[&str],
|
||||
) -> Result<Option<DefaultBranchFiles>> {
|
||||
let info = self
|
||||
.api
|
||||
|
|
@ -1453,9 +1468,12 @@ impl Client {
|
|||
if info.empty.unwrap_or(false) {
|
||||
return Ok(None);
|
||||
}
|
||||
let branch = info
|
||||
.default_branch
|
||||
.with_context(|| format!("{owner}/{repo} names no default branch"))?;
|
||||
let branch = match branch {
|
||||
Some(branch) => branch.to_owned(),
|
||||
None => info
|
||||
.default_branch
|
||||
.with_context(|| format!("{owner}/{repo} names no default branch"))?,
|
||||
};
|
||||
let head = match self
|
||||
.api
|
||||
.call(|api| api.repo_get_branch(owner, repo, &branch).into_future())
|
||||
|
|
|
|||
Loading…
Reference in a new issue