Skip to content

Commit 4ceefad

Browse files
fix: inject buttons only on pull request page (#31)
Fixes MRGFY-4496
1 parent 851b97a commit 4ceefad

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/mergify.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,18 @@ function buildMergifySectionForNewMergeBox () {
215215
}
216216

217217

218+
function isGitHubPullRequestPage() {
219+
var url = new URL(document.location.href);
220+
var parts = url.pathname.split("/");
221+
return parts.length >= 5 && parts[3] === 'pull';
222+
}
223+
224+
218225
function tryInject() {
226+
if (!isGitHubPullRequestPage()) {
227+
return
228+
}
229+
219230
var isMergifyEnabledOnTheRepo = document.querySelector('a[href="/apps/mergify"]')
220231
if (!isMergifyEnabledOnTheRepo) {
221232
return
@@ -234,7 +245,6 @@ function tryInject() {
234245
// New merge box
235246
var detailSection = document.querySelector("div.border:nth-child(2)")
236247
if (detailSection) {
237-
console.log("Injecting Mergify section for new merge box")
238248
detailSection.insertBefore(buildMergifySectionForNewMergeBox(), detailSection.firstChild)
239249
}
240250
}

0 commit comments

Comments
 (0)