Skip to content

Commit 95ae871

Browse files
committed
Remove the head_repo stuff, it's a bit optimisitc right now.
1 parent 1c39183 commit 95ae871

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/lib/enhancers/github/githubPRNewComment.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ interface GitHubPRNewCommentSpot extends CommentSpot {
1010
domain: string
1111
slug: string // owner/repo
1212
title: string
13-
head: string // branch name where changes are implemented
14-
head_repo?: string // repository where changes were made (for cross-repo PRs)
13+
head: string // `user:repo:branch` where changes are implemented
1514
base: string // branch you want changes pulled into
1615
}
1716

@@ -44,23 +43,17 @@ export class GitHubPRNewCommentEnhancer implements CommentEnhancer<GitHubPRNewCo
4443
const [, owner, repo, baseBranch, compareBranch] = match
4544
const slug = `${owner}/${repo}`
4645
const base = baseBranch || 'main'
47-
const head = compareBranch
46+
const head = compareBranch!
4847
const unique_key = `github.com:${slug}:${base}...${head}`
4948
const titleInput = document.querySelector('input[placeholder="Title"]') as HTMLInputElement
50-
const title = titleInput?.value || ''
51-
52-
// Check if this is a cross-repository PR by looking at the head repository button
53-
const headRepoButton = document.querySelector('button[aria-label*="head repository:"]')
54-
const headRepoText = headRepoButton?.textContent
55-
const headRepo = headRepoText?.includes('/') ? headRepoText.split(':')[1]?.trim() : undefined
49+
const title = titleInput!.value
5650

5751
return {
52+
base,
5853
domain: location.host,
54+
head,
5955
slug,
6056
title,
61-
head,
62-
head_repo: headRepo,
63-
base,
6457
type: 'GH_PR_NEW_COMMENT',
6558
unique_key,
6659
}

tests/lib/enhancers/github.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ describe('github', () => {
8585
"base": "main",
8686
"domain": "github.com",
8787
"head": "cavia-porcellus:selfie:main",
88-
"head_repo": undefined,
8988
"slug": "diffplug/selfie",
9089
"title": "Update README.md",
9190
"type": "GH_PR_NEW_COMMENT",

0 commit comments

Comments
 (0)