Skip to content
Open
11 changes: 0 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ jobs:
npm_config_build_from_source=true npx @electron/rebuild -f -a "$A" -v "$ELECTRON_VERSION" -w sqlite3,node-pty,keytar
done

- name: Rebuild native modules (per-arch)
run: |
set -euo pipefail
ELECTRON_VERSION=$(node -p "require('electron/package.json').version")
ARCH_INPUT="${{ github.event.inputs.arch }}"
if [ -z "$ARCH_INPUT" ] || [ "$ARCH_INPUT" = "both" ]; then ARGS=(x64 arm64); else ARGS=("$ARCH_INPUT"); fi
echo "Rebuilding sqlite3,node-pty,keytar for Electron $ELECTRON_VERSION: ${ARGS[*]}"
for A in "${ARGS[@]}"; do
npm_config_build_from_source=true npx @electron/rebuild -f -a "$A" -v "$ELECTRON_VERSION" -w sqlite3,node-pty,keytar
done

- name: Inject PostHog config (dev build job)
env:
PH_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }}
Expand Down
26 changes: 20 additions & 6 deletions src/main/services/GitHubService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,28 @@ export class GitHubService {
try {
const token = await this.getStoredToken();

if (!token) {
// No stored token, user needs to authenticate
return false;
if (token) {
// Test the token by making a simple API call
const user = await this.getUserInfo(token);
return !!user;
}

// Test the token by making a simple API call
const user = await this.getUserInfo(token);
return !!user;
// No stored token: treat an existing `gh auth login` as authenticated and
// opportunistically persist the token so we can re-auth `gh` later.
try {
const { stdout } = await this.execGH('gh auth status');
const loggedIn = /Logged in to github\.com/i.test(stdout);
if (!loggedIn) return false;

const { stdout: tokenStdout } = await this.execGH('gh auth token');
const cliToken = String(tokenStdout || '').trim();
if (cliToken) {
await this.storeToken(cliToken);
}
return true;
} catch {
return false;
}
} catch (error) {
console.error('Authentication check failed:', error);
return false;
Expand Down
Loading