use GITHUB_REPOSITORY for context

This commit is contained in:
ssalbdivad
2025-10-09 17:04:03 -04:00
parent 9459803aaa
commit 3e7122611c
7 changed files with 381 additions and 398 deletions
+22
View File
@@ -0,0 +1,22 @@
export interface RepoContext {
owner: string;
name: string;
}
/**
* Resolve repository context from GITHUB_REPOSITORY environment variable.
* Throws if not available.
*/
export function resolveRepoContext(): RepoContext {
const githubRepo = process.env.GITHUB_REPOSITORY;
if (!githubRepo) {
throw new Error('GITHUB_REPOSITORY environment variable is required');
}
const [owner, name] = githubRepo.split('/');
if (!owner || !name) {
throw new Error(`Invalid GITHUB_REPOSITORY format: ${githubRepo}. Expected 'owner/repo'`);
}
return { owner, name };
}