fix: fallback to local e2e repo when gh user lookup is invalid
This commit is contained in:
parent
c9336c03d6
commit
e2289bfbd5
@ -46,6 +46,10 @@ function getGitHubUser(): string {
|
|||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
}).trim();
|
}).trim();
|
||||||
|
|
||||||
|
if (user.startsWith('<')) {
|
||||||
|
throw new Error('Unexpected HTML response from gh api user');
|
||||||
|
}
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Failed to get GitHub user. Make sure `gh` CLI is authenticated.',
|
'Failed to get GitHub user. Make sure `gh` CLI is authenticated.',
|
||||||
@ -128,7 +132,12 @@ export function createTestRepo(options?: CreateTestRepoOptions): TestRepo {
|
|||||||
return createOfflineTestRepo(options);
|
return createOfflineTestRepo(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = getGitHubUser();
|
let user: string;
|
||||||
|
try {
|
||||||
|
user = getGitHubUser();
|
||||||
|
} catch {
|
||||||
|
return createOfflineTestRepo(options);
|
||||||
|
}
|
||||||
const repoName = `${user}/takt-testing`;
|
const repoName = `${user}/takt-testing`;
|
||||||
|
|
||||||
// Verify repository exists
|
// Verify repository exists
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user