mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00

* feat: streamline code styles * feat: spacing for comments and return statements * chore: enforce camelcase * fix: remove npm lock file * fix: add integrity test * fix: remove logfile * chore: update node in test workflow
23 lines
681 B
TypeScript
23 lines
681 B
TypeScript
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system';
|
|
import * as core from '@actions/core';
|
|
|
|
export class GithubCliReader {
|
|
static async GetGitHubAuthToken() {
|
|
try {
|
|
const authStatus = await CloudRunnerSystem.Run(`gh auth status`, true, true);
|
|
if (authStatus.includes('You are not logged') || authStatus === '') {
|
|
return '';
|
|
}
|
|
|
|
return (await CloudRunnerSystem.Run(`gh auth status -t`, false, true))
|
|
.split(`Token: `)[1]
|
|
.replace(/ /g, '')
|
|
.replace(/\n/g, '');
|
|
} catch (error: any) {
|
|
core.info(error || 'Failed to get github auth token from gh cli');
|
|
|
|
return '';
|
|
}
|
|
}
|
|
}
|