Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix repo and owner parsing

Tomas Valenta9fa66eb02d6c
diff --git a/components/Repos.tsx b/components/Repos.tsx
index f5326413f..cd5cf3fca 100644
--- a/components/Repos.tsx
+++ b/components/Repos.tsx
@@ -14,6 +14,7 @@ import TitleButton from 'components/TitleButton'
import Input from 'components/Input'
import SpinnerIcon from 'components/Spinner'
import { useLocalStorage } from 'hooks/useLocalStorage'
+import { parseRepoName } from 'github/repo'
export interface PostProjectBody {
repositoryID: number
@@ -61,11 +62,12 @@ function Repos({ onRepoSelection }: Props) {
}, [refetch, setAccessToken])
useListenMessage(handleEvent)
- async function selectRepository(r: Omit<RepoSetup, 'branches'>) {
- if (!accessToken) return
+ async function selectRepository(r: Omit<RepoSetup, 'branches' | 'owner' | 'repo'>) {
+
onRepoSelection({
...r,
branches: [r.defaultBranch],
+ ...parseRepoName(r.fullName),
})
const [repositoryOwnerName, repositoryName] = r.fullName.split('/')
@@ -78,6 +80,7 @@ function Repos({ onRepoSelection }: Props) {
onRepoSelection({
...r,
branches,
+ ...parseRepoName(r.fullName),
})
}
@@ -177,8 +180,6 @@ function Repos({ onRepoSelection }: Props) {
repositoryID: r.id,
fullName: r.full_name,
url: r.html_url,
- owner: r.owner.name || r.organization?.name as string,
- repo: r.name,
})}
text="Select"
/>
diff --git a/github/repo.ts b/github/repo.ts
new file mode 100644
index 000000000..d45a5a352
--- /dev/null
+++ b/github/repo.ts
@@ -0,0 +1,4 @@
+export function parseRepoName(fullName: string) {
+ const [owner, repo] = fullName.split('/')
+ return { owner, repo }
+}
diff --git a/github/webhooks.ts b/github/webhooks.ts
index 33eb68455..e8305fce4 100644
--- a/github/webhooks.ts
+++ b/github/webhooks.ts
@@ -6,6 +6,7 @@ import {
import { getDeploymentsForPR, getGHAccessToken, getPromptFromPR, triggerSmolDevAgentRun } from './pullRequest'
import { getGHInstallationClient } from './installationClient'
+import { parseRepoName } from './repo'
export async function getGitHubWebhooksMiddleware() {
const webhooks = new Webhooks({
@@ -23,8 +24,7 @@ const issueCommentHandler: HandlerFunction<'issue_comment', unknown> = async (ev
const installationID = payload.installation?.id
const repositoryID = payload.repository.id
- const repo = payload.repository.name
- const owner = payload.repository.owner.name || payload.repository.organization as string
+ const { owner, repo } = parseRepoName(payload.repository.full_name)
// Every PR is also an issues - GH API endpoint for issues is used for the shared functionality
const issueID = payload.issue.id
diff --git a/pages/agent/smol-developer/setup.tsx b/pages/agent/smol-developer/setup.tsx
index c97574704..3553c7f22 100644
--- a/pages/agent/smol-developer/setup.tsx
+++ b/pages/agent/smol-developer/setup.tsx
@@ -80,7 +80,10 @@ function Repo() {
async function deployAgent() {
if (!selectedRepo) return
+ console.log('selectedRepo', selectedRepo)
+
+ return
await createAgent({
defaultBranch: selectedRepo.defaultBranch,
installationID: selectedRepo.installationID,