Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): outdated gh no longer reads as "not authenticated" #7588

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/7588/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 4 changed files with 27 additions and 1 deletion (loading 1).

x
0 of 4 viewed, 4 left
15 additions and 0 deletionsapps/server/src/sourceControl/GitHubSourceControlProvider.test.tsModified
View file
@@ -381,3 +381,18 @@
});
+​
+it("reports an update hint instead of unauthenticated when gh predates --json", () => {
+ const auth = GitHubSourceControlProvider.discovery.parseAuth(
+ processResult("", {
+ stderr: "unknown flag: --json\n\nUsage: gh auth status [flags]\n",
+ exitCode: ChildProcessSpawner.ExitCode(1),
+ }),
+ );
+​
+ assert.strictEqual(auth.status, "unknown");
+ assert.match(
+ Option.getOrElse(auth.detail, () => ""),
+ /2\.81\.0/,
+ );
+});
10 additions and 0 deletionsapps/server/src/sourceControl/GitHubSourceControlProvider.tsModified
View file
@@ -67,6 +67,16 @@
});
​
+ // gh gained `auth status --json` in 2.81.0. Older versions reject the flag and exit
+ // non-zero, which reads exactly like a signed-out CLI. Name the real problem instead.
+ if (input.exitCode !== 0 && output.includes("unknown flag: --json")) {
+ return providerAuth({