Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add utm to GH links

Tomas Valentae3ffee5a7b63
diff --git a/github/pullRequest.ts b/github/pullRequest.ts
index 680c832c1..4b5b090ae 100644
--- a/github/pullRequest.ts
+++ b/github/pullRequest.ts
@@ -167,13 +167,15 @@ export async function getPromptFromPR({
}),
])
- const prBody = issueResult?.data.body || body
+ const prBody = issueResult?.data.body || body!
const comments = commentsResult.data
.filter(c => c.user?.type !== 'Bot')
.map(c => c.body)
.join('\n')
- return `${prBody?.replace(prInfoText, '')}\n\n${comments}`
+ const indexOfSub = prBody.indexOf(prInfoText)
+ const prBodyWithoutInfo = prBody.substring(0, indexOfSub)
+ return `${prBodyWithoutInfo}\n\n${comments}`
}
export async function getDeploymentsForPR({
@@ -278,7 +280,7 @@ export async function triggerSmolDevAgentRun({
console.log('Triggering smol dev agent run:', { owner, repo, pullNumber, prompt })
await addCommentToPR({
- body: `Started smol developer [agent run](https://app.e2b.dev/logs/${slug}-run-${totalRuns}).`,
+ body: `Started smol developer [agent run](https://app.e2b.dev/logs/${slug}-run-${totalRuns}?utm_source=github).`,
client,
owner,
repo,
diff --git a/pages/api/agent/index.ts b/pages/api/agent/index.ts
index a7f9adacb..20fe0a52f 100644
--- a/pages/api/agent/index.ts
+++ b/pages/api/agent/index.ts
@@ -38,7 +38,7 @@ export const prInfoText = `
---
*Add PR comments with additional instructions to trigger the agent again.*
-*Powered by [e2b](https://app.e2b.dev/agent/smol-developer)*
+*Powered by [e2b](https://app.e2b.dev/agent/smol-developer?utm_source=github)*
`
async function postAgent(req: NextApiRequest, res: NextApiResponse) {
diff --git a/pages/api/agent/run.ts b/pages/api/agent/run.ts
index 0f993ae71..df9f16ec1 100644
--- a/pages/api/agent/run.ts
+++ b/pages/api/agent/run.ts
@@ -64,7 +64,7 @@ async function postRun(req: NextApiRequest, res: NextApiResponse) {
// TODO: Should we maybe just edit the previous comment?
// Or should we do that only if the previous run was cancelled
await addCommentToPR({
- body: `Finished smol developer [agent run](https://app.e2b.dev/logs/${deployment.projects.slug}-run-${deployment._count.log_files - 1}).`,
+ body: `Finished smol developer [agent run](https://app.e2b.dev/logs/${deployment.projects.slug}-run-${deployment._count.log_files - 1}?utm_source=github).`,
client,
owner: authData.github.owner,
repo: authData.github.repo,
@@ -154,7 +154,7 @@ async function deleteRun(req: NextApiRequest, res: NextApiResponse) {
if (deployment.enabled) {
// Add comment about the run being cancelled
await addCommentToPR({
- body: `Cancelled smol developer [agent run](https://app.e2b.dev/logs/${deployment.projects.slug}-run-${deployment._count.log_files - 1}).`,
+ body: `Cancelled smol developer [agent run](https://app.e2b.dev/logs/${deployment.projects.slug}-run-${deployment._count.log_files - 1}?utm_source=github).`,
client,
owner: authData.github.owner,
repo: authData.github.repo,