Skip to content

Commit 9d63fe7

Browse files
committed
Break after merge to give GH API time to update
1 parent ffff7ad commit 9d63fe7

File tree

2 files changed

+27
-58
lines changed

2 files changed

+27
-58
lines changed

src/bors/comment.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,3 @@ pub fn auto_build_push_failed_comment(error: &str) -> Comment {
227227
":eyes: Test was successful, but fast-forwarding failed: {error}",
228228
))
229229
}
230-
231-
pub fn auto_build_base_moved_comment(
232-
base_ref: &str,
233-
old_base: &CommitSha,
234-
new_base: &CommitSha,
235-
) -> Comment {
236-
Comment::new(format!(
237-
":warning: Auto build outdated due to push to {base_ref} ({old_base} → {new_base}). Auto build will be rebuilt.",
238-
))
239-
}

src/bors/merge_queue.rs

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use crate::{
88
bors::{
99
PullRequestStatus, RepositoryState,
1010
comment::{
11-
auto_build_base_moved_comment, auto_build_push_failed_comment,
12-
auto_build_started_comment, merge_conflict_comment,
11+
auto_build_push_failed_comment, auto_build_started_comment, merge_conflict_comment,
1312
},
1413
handlers::labels::handle_label_trigger,
1514
},
@@ -85,55 +84,35 @@ pub async fn handle_merge_queue(ctx: Arc<BorsContext>) -> anyhow::Result<()> {
8584
.await?;
8685
}
8786
Err(error) => {
88-
let current_base_sha =
89-
repo.client.get_branch_sha(&pr.base_branch).await?;
90-
let build_time_base_sha = CommitSha(auto_build.parent.clone());
91-
92-
if current_base_sha != build_time_base_sha {
93-
tracing::info!(
94-
"Base branch has moved for PR {pr_num} (was: {}, now: {}). Deleting auto build.",
95-
build_time_base_sha,
96-
current_base_sha
97-
);
98-
99-
let comment = auto_build_base_moved_comment(
100-
&pr.base_branch,
101-
&build_time_base_sha,
102-
&current_base_sha,
103-
);
104-
repo.client.post_comment(pr.number, comment).await?;
105-
106-
ctx.db.delete_auto_build(&pr).await?;
107-
} else {
108-
tracing::error!(
109-
"Failed to push PR {pr_num} to base branch: {:?}",
110-
error
111-
);
112-
113-
let gh_pr = repo.client.get_pull_request(pr_num).await?;
114-
115-
let desc = format!(
116-
"Test was successful, but fast-forwarding failed: {}",
117-
&error.to_string()
118-
);
119-
repo.client
120-
.create_commit_status(
121-
&gh_pr.head.sha,
122-
StatusState::Error,
123-
None,
124-
Some(&desc),
125-
Some("bors"),
126-
)
127-
.await?;
128-
129-
let comment =
130-
auto_build_push_failed_comment(&error.to_string());
131-
repo.client.post_comment(pr.number, comment).await?;
132-
}
87+
tracing::error!(
88+
"Failed to push PR {pr_num} to base branch: {:?}",
89+
error
90+
);
91+
92+
let gh_pr = repo.client.get_pull_request(pr_num).await?;
93+
94+
let desc = format!(
95+
"Test was successful, but fast-forwarding failed: {}",
96+
&error.to_string()
97+
);
98+
repo.client
99+
.create_commit_status(
100+
&gh_pr.head.sha,
101+
StatusState::Error,
102+
None,
103+
Some(&desc),
104+
Some("bors"),
105+
)
106+
.await?;
107+
108+
let comment = auto_build_push_failed_comment(&error.to_string());
109+
repo.client.post_comment(pr.number, comment).await?;
133110
}
134111
};
135112

136-
continue;
113+
// We break rather than continue to give GitHub time to update the base
114+
// branch.
115+
break;
137116
}
138117
// Build in progress - stop queue. We can only have one PR built at a time.
139118
BuildStatus::Pending => {

0 commit comments

Comments
 (0)