Skip to content

Commit f568bf7

Browse files
authored
Merge pull request #2174 from Kobzol/remove-master-dependency
Do not hardcode the "master" branch
2 parents 346ecd6 + 230c2c7 commit f568bf7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/gh_range_diff.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ pub async fn gh_range_diff(
5757
repository: repo.to_string(),
5858
};
5959

60+
let gh_repo = ctx.github.repository(&format!("{owner}/{repo}")).await?;
61+
6062
// Determine the oldbase and get the comparison for the old diff
6163
let old = async {
6264
// We need to determine the oldbase (ie. the parent sha of all the commits of old).
@@ -73,7 +75,7 @@ pub async fn gh_range_diff(
7375
// is always correct no matter the order.
7476
let oldbase = ctx
7577
.github
76-
.compare(&issue_repo, "master", oldhead)
78+
.compare(&issue_repo, &gh_repo.default_branch, oldhead)
7779
.await
7880
.context("failed to retrive the comparison between newhead and oldhead")?
7981
.merge_base_commit
@@ -98,9 +100,9 @@ pub async fn gh_range_diff(
98100
// See the comment above on old for more details.
99101
let newbase = ctx
100102
.github
101-
.compare(&issue_repo, "master", newhead)
103+
.compare(&issue_repo, &gh_repo.default_branch, newhead)
102104
.await
103-
.context("failed to retrive the comparison between master and newhead")?
105+
.context("failed to retrive the comparison between the default branch and newhead")?
104106
.merge_base_commit
105107
.sha;
106108

src/handlers/rustc_commits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
6868
log::trace!("Not build completion? {:?}", bors);
6969
}
7070

71-
if bors.base_ref != "master" {
72-
log::trace!("Ignoring bors merge, not on master");
71+
if bors.base_ref != event.repository.default_branch {
72+
log::trace!("Ignoring bors merge, not on the default branch");
7373
return Ok(());
7474
}
7575

0 commit comments

Comments
 (0)