cleanup, add InstallationToken type

This commit is contained in:
ssalbdivad
2025-09-23 12:48:35 -04:00
parent f2a1c3c1bb
commit e13c5eed00
13 changed files with 127 additions and 144 deletions
+5 -5
View File
@@ -3,19 +3,19 @@ import { existsSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { config } from "dotenv";
import { buildAction, setupTestRepo } from "./setup";
import { buildAction, setupTestRepo } from "./setup.ts";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const tempDir = join(__dirname, "..", ".temp");
const actionPath = join(__dirname, "..");
const envPath = join(__dirname, "..", "..", ".env");
// Environment variables that should be passed as secrets to the workflow
const ENV_VARS = ["ANTHROPIC_API_KEY", "GITHUB_INSTALLATION_TOKEN"];
export function runAct(prompt: string): void {
const tempDir = join(__dirname, "..", ".temp");
const actionPath = join(__dirname, "..");
const envPath = join(__dirname, "..", "..", ".env");
// Setup test repository
setupTestRepo({ tempDir });
+12 -1
View File
@@ -1,5 +1,15 @@
import * as core from "@actions/core";
export interface InstallationToken {
token: string;
expires_at: string;
installation_id: number;
repository: string;
ref: string;
runner_environment: string;
owner?: string;
}
/**
* Setup GitHub installation token for the action
*/
@@ -42,7 +52,8 @@ export async function setupGitHubInstallationToken(): Promise<string> {
);
}
const tokenData = await tokenResponse.json();
// This type is enforced by us when the response is created
const tokenData = (await tokenResponse.json()) as InstallationToken;
core.info(`Installation token obtained for ${tokenData.repository || "all repositories"}`);
// Mask the token in logs for security
-5
View File
@@ -1,5 +0,0 @@
export * from "./files";
export * from "./github";
export * from "./setup";
export * from "./subprocess";
export * from "./table";