Skip to content

Commit 2d0b8db

Browse files
committed
Address small PR nits
1 parent f870632 commit 2d0b8db

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

site/src/api.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ pub mod github {
413413
pub struct Push {
414414
pub r#ref: String,
415415
pub sender: Sender,
416-
pub committer: Committer,
417416
pub head_commit: HeadCommit,
418417
pub before: String,
419418
pub commits: Vec<Commit>,
@@ -436,11 +435,6 @@ pub mod github {
436435
pub login: String,
437436
}
438437

439-
#[derive(Debug, Clone, Serialize, Deserialize)]
440-
pub struct Committer {
441-
pub username: String,
442-
}
443-
444438
#[derive(Debug, Clone, Serialize, Deserialize)]
445439
pub struct Response;
446440
}

site/src/github.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pub async fn merge_branch(
368368
.basic_auth("rust-timer", Some(timer_token))
369369
.send()
370370
.await
371-
.context("POST git/commits failed")?;
371+
.context("PATCH /merges failed")?;
372372
if !response.status().is_success() {
373373
anyhow::bail!("{:?} != 201 CREATED", response.status());
374374
}
@@ -445,7 +445,10 @@ pub async fn get_issue(
445445
.basic_auth("rust-timer", Some(timer_token))
446446
.send()
447447
.await
448-
.context("cannot get commit")?;
448+
.context("cannot get issue")?;
449+
if !response.status().is_success() {
450+
anyhow::bail!("{:?} != 200 OK", response.status());
451+
}
449452

450453
Ok(response.json().await?)
451454
}

site/src/request_handlers/github.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ async fn handle_push(ctxt: Arc<SiteCtxt>, push: github::Push) -> ServerResult<gi
5757
// The second parent is the head of the PR that was rolled up. We want the second parent.
5858
let commit = get_commit(&client, &ctxt, repository_url, &rollup_merge)
5959
.await
60-
.map_err(|e| format!("Error getting rollup merge commit: {e:?}"))?;
60+
.map_err(|e| format!("Error getting rollup merge commit '{rollup_merge}': {e:?}"))?;
6161
assert!(
6262
commit.parents.len() == 2,
63-
"What we thought was a merge commit was not a merge commit"
63+
"What we thought was a merge commit was not a merge commit. sha: {}",
64+
rollup_merge
6465
);
6566
let rolled_up_head = &commit.parents[1].sha;
6667

@@ -106,9 +107,8 @@ async fn is_rollup(
106107
}
107108
};
108109
}
109-
let is_bors = push.sender.login == "bors"
110-
&& push.committer.username == "bors"
111-
&& push.head_commit.message.starts_with("Auto merge of");
110+
let is_bors =
111+
push.sender.login == "bors" && push.head_commit.message.starts_with("Auto merge of");
112112

113113
if !is_bors {
114114
return Ok(false);

0 commit comments

Comments
 (0)