Skip to content

Commit 5b78c3d

Browse files
authored
remove old gh env var (#35)
1 parent 342b240 commit 5b78c3d

File tree

4 files changed

+5
-39
lines changed

4 files changed

+5
-39
lines changed

AGENTS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ console.error('Error occurred:', error)
3232
- **No exceptions**: This applies to ALL log levels (info, error, success, command, console.log, console.error, console.warn, etc.)
3333

3434
#### Sensitive Data That Must NEVER Appear in Logs:
35-
- API keys and tokens (ANTHROPIC_API_KEY, OPENAI_API_KEY, GITHUB_TOKEN, etc.)
3635
- Vercel credentials (VERCEL_TOKEN, VERCEL_TEAM_ID, VERCEL_PROJECT_ID)
3736
- User IDs and personal information
3837
- File paths and repository URLs
@@ -120,7 +119,6 @@ Never expose these in logs or to the client:
120119
- `VERCEL_PROJECT_ID` - Vercel project identifier
121120
- `ANTHROPIC_API_KEY` - Anthropic/Claude API key
122121
- `OPENAI_API_KEY` - OpenAI API key
123-
- `GITHUB_TOKEN` - GitHub API token
124122
- `JWE_SECRET` - Encryption secret
125123
- `ENCRYPTION_KEY` - Encryption key
126124
- Any user-provided API keys

lib/github/client.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,3 @@ export async function getOctokit(): Promise<Octokit> {
1717
auth: userToken || undefined,
1818
})
1919
}
20-
21-
/**
22-
* @deprecated Use getOctokit() instead for per-user authentication
23-
* Legacy client using GITHUB_TOKEN env var - kept for backwards compatibility
24-
*/
25-
export const octokit = new Octokit({
26-
auth: process.env.GITHUB_TOKEN,
27-
})

lib/sandbox/config.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export function validateEnvironmentVariables(
4242
}
4343

4444
// Check for GitHub token for private repositories
45-
// Use user's token if provided, otherwise fall back to GITHUB_TOKEN
46-
if (!githubToken && !process.env.GITHUB_TOKEN) {
47-
errors.push('GITHUB_TOKEN is required for repository access. Please connect your GitHub account.')
45+
// Use user's token if provided
46+
if (!githubToken) {
47+
errors.push('GitHub is required for repository access. Please connect your GitHub account.')
4848
}
4949

5050
// Check for Vercel sandbox environment variables
@@ -67,18 +67,15 @@ export function validateEnvironmentVariables(
6767
}
6868

6969
export function createAuthenticatedRepoUrl(repoUrl: string, githubToken?: string | null): string {
70-
// Use user's token if provided, otherwise fall back to GITHUB_TOKEN
71-
const token = githubToken || process.env.GITHUB_TOKEN
72-
73-
if (!token) {
70+
if (!githubToken) {
7471
return repoUrl
7572
}
7673

7774
try {
7875
const url = new URL(repoUrl)
7976
if (url.hostname === 'github.com') {
8077
// Add GitHub token for authentication
81-
url.username = token
78+
url.username = githubToken
8279
url.password = 'x-oauth-basic'
8380
}
8481
return url.toString()

lib/sandbox/creation.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -340,27 +340,6 @@ export async function createSandbox(config: SandboxConfig, logger: TaskLogger):
340340
await logger.info('Git repository detected')
341341
}
342342

343-
// Add debugging information about Git state
344-
await logger.info('Debugging Git repository state')
345-
const gitStatusDebug = await runCommandInSandbox(sandbox, 'git', ['status', '--porcelain'])
346-
await logger.info('Git status checked')
347-
348-
const gitBranchDebug = await runCommandInSandbox(sandbox, 'git', ['branch', '-a'])
349-
await logger.info('Git branches checked')
350-
351-
const gitRemoteDebug = await runCommandInSandbox(sandbox, 'git', ['remote', '-v'])
352-
await logger.info('Git remotes checked')
353-
354-
// Configure Git to use GitHub token for authentication
355-
if (process.env.GITHUB_TOKEN) {
356-
await logger.info('Configuring Git authentication with GitHub token')
357-
await runCommandInSandbox(sandbox, 'git', ['config', 'credential.helper', 'store'])
358-
359-
// Create credentials file with GitHub token
360-
const credentialsContent = `https://${process.env.GITHUB_TOKEN}:x-oauth-basic@github.com`
361-
await runCommandInSandbox(sandbox, 'sh', ['-c', `echo "${credentialsContent}" > ~/.git-credentials`])
362-
}
363-
364343
let branchName: string
365344

366345
if (config.existingBranchName) {

0 commit comments

Comments
 (0)