diff --git a/fixtures/basic.txt b/fixtures/basic.txt index 117d20a..482eeb8 100644 --- a/fixtures/basic.txt +++ b/fixtures/basic.txt @@ -1,3 +1 @@ -Print the MCP tools available to you. -Try to call select_mode with the name "Plan". -Then tell me a joke \ No newline at end of file +write a comment to https://github.com/pullfrogai/scratch/pull/29 that tells a joke \ No newline at end of file diff --git a/main.ts b/main.ts index 9127a99..13dac65 100644 --- a/main.ts +++ b/main.ts @@ -135,7 +135,6 @@ To fix this, add the required secret to your GitHub repository: interface MainContext { inputs: Inputs; githubInstallationToken: string; - tokenToRevoke: string | null; repoContext: RepoContext; agentName: AgentNameType; agent: (typeof agents)[AgentNameType]; @@ -155,16 +154,14 @@ async function initializeContext( Inputs.assert(inputs); setupGitConfig(); - const { githubInstallationToken, wasAcquired } = await setupGitHubInstallationToken(); - const tokenToRevoke = wasAcquired ? githubInstallationToken : null; + const githubInstallationToken = await setupGitHubInstallationToken(); const repoContext = parseRepoContext(); return { inputs, githubInstallationToken, - tokenToRevoke, repoContext, - agentName: "claude" as AgentNameType, + agentName: "claude", agent: agents.claude, sharedTempDir: "", mcpLogPath: "", @@ -292,7 +289,5 @@ async function cleanup(ctx: Omit { // we don't need to extract it here since main() will parse the payload const inputs: Required = { prompt, - defaultAgent: "cursor", + defaultAgent: "gemini", ...flatMorph(agents, (_, agent) => agent.apiKeyNames.map((inputKey) => [inputKey, process.env[inputKey.toUpperCase()]]) ), diff --git a/utils/github.ts b/utils/github.ts index 98fb24f..f1649a5 100644 --- a/utils/github.ts +++ b/utils/github.ts @@ -43,12 +43,6 @@ interface RepositoriesResponse { repositories: Repository[]; } -function checkExistingToken(): string | null { - const inputToken = core.getInput("github_installation_token"); - const envToken = process.env.GITHUB_INSTALLATION_TOKEN; - return inputToken || envToken || null; -} - function isGitHubActionsEnvironment(): boolean { return Boolean(process.env.GITHUB_ACTIONS); } @@ -249,24 +243,13 @@ async function acquireNewToken(): Promise { /** * Setup GitHub installation token for the action - * Returns the token and whether it was acquired (needs revocation) */ -export async function setupGitHubInstallationToken(): Promise<{ - githubInstallationToken: string; - wasAcquired: boolean; -}> { - const existingToken = checkExistingToken(); - if (existingToken) { - core.setSecret(existingToken); - log.info("Using provided GitHub installation token"); - return { githubInstallationToken: existingToken, wasAcquired: false }; - } - +export async function setupGitHubInstallationToken(): Promise { const acquiredToken = await acquireNewToken(); core.setSecret(acquiredToken); process.env.GITHUB_INSTALLATION_TOKEN = acquiredToken; - return { githubInstallationToken: acquiredToken, wasAcquired: true }; + return acquiredToken; } /**