From ea3ce5bdbc28b0079c6d22ee835f6139016ddb3f Mon Sep 17 00:00:00 2001 From: Kalrnlo <62822174+kalrnlo@users.noreply.github.com> Date: Sun, 28 Jul 2024 12:41:36 -0600 Subject: [PATCH 1/2] Update mod.rs --- lib/sources/github/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sources/github/mod.rs b/lib/sources/github/mod.rs index 9f0da0f..2cf1ea4 100644 --- a/lib/sources/github/mod.rs +++ b/lib/sources/github/mod.rs @@ -95,7 +95,9 @@ impl GithubProvider { pub fn new_authenticated(pat: impl AsRef) -> GithubResult { let pat: String = pat.as_ref().trim().to_string(); // https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/ - if pat.starts_with("ghp_") || pat.starts_with("gho_") { + // github codespaces uses ghu: ^ghu_[a-zA-z1-9]{36}$ (match ghu_N where N is 36 alphanumeric characters) + // https://discord.com/channels/385151591524597761/385151591998816257/1267180689825202256 + if pat.starts_with("ghp_") || pat.starts_with("gho_") || pat.starts_with("ghu_") { Self::new_inner(Some(pat)) } else { Err(GithubError::UnrecognizedAccessToken) From 5a0a3b746ae71866c77daf357e3be6781c8fd850 Mon Sep 17 00:00:00 2001 From: Kalrnlo <62822174+kalrnlo@users.noreply.github.com> Date: Sun, 28 Jul 2024 12:43:45 -0600 Subject: [PATCH 2/2] Update result.rs --- lib/sources/github/result.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sources/github/result.rs b/lib/sources/github/result.rs index 76c8155..4d1ba5e 100644 --- a/lib/sources/github/result.rs +++ b/lib/sources/github/result.rs @@ -5,7 +5,7 @@ use crate::tool::{ToolId, ToolSpec}; #[derive(Debug, Error)] pub enum GithubError { - #[error("unrecognized access token format - must begin with `ghp_` or `gho_`.")] + #[error("unrecognized access token format - must begin with `ghp_`, `gho_`, or `ghu_`.")] UnrecognizedAccessToken, #[error("no latest release was found for tool '{0}'")] LatestReleaseNotFound(Box),