You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tracing::warn!("synchronize event but no before or after field");
22
+
returnOk(());
23
+
};
24
+
25
+
let base = event.issue.base.as_ref().context("no base ref")?;
26
+
let org = event.repository.owner();
27
+
let repo = event.repository.name();
28
+
29
+
let compare_before = ctx
30
+
.github
31
+
.compare(
32
+
&IssueRepository{
33
+
organization: org.to_string(),
34
+
repository: repo.to_string(),
35
+
},
36
+
&base.sha,
37
+
&before,
38
+
)
39
+
.await
40
+
.context("failed to get the before compare")?;
41
+
42
+
// Does the merge_base_commits differs? No, not a force-push with rebase.
43
+
if compare_before.merge_base_commit.sha == compare_after.merge_base_commit.sha{
44
+
returnOk(());
45
+
}
46
+
47
+
let protocol = if host.starts_with("localhost:"){
48
+
"http"
49
+
}else{
50
+
"https"
51
+
};
52
+
53
+
let branch = &base.git_ref;
54
+
55
+
// Rebase detected, post a comment to our range-diff.
56
+
event.issue.post_comment(&ctx.github,
57
+
&format!(r#"This PR was rebased onto a different {branch} commit! Check out the changes with our [`range-diff`]({protocol}://{host}/gh-range-diff/{org}/{repo}/{before}..{after})."#)
58
+
).await.context("failed to post range-diff comment")?;
0 commit comments