Skip to content

Commit

Permalink
fix: support new gh auth status output (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrindel committed Dec 19, 2023
1 parent 60453e9 commit 96e82a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shlib/lib/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ get_gh_username() {
local auth_status="${1:-}"
[[ -z "${auth_status}" ]] && auth_status="$( get_gh_auth_status )"
echo "${auth_status}" | \
sed -E -n 's/^.* Logged in to [^[:space:]]+ as ([^[:space:]]+).*/\1/gp'
sed -E -n 's/^.* Logged in to [^[:space:]]+ account ([^[:space:]]+).*/\1/gp'
}

# Returns the current user's auth token from the auth status.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ source "${github_sh}"

auth_status="
github.com
✓ Logged in to github.com as cgrindel (/Users/chuck/.config/gh/hosts.yml)
✓ Git operations for github.com configured to use ssh protocol.
✓ Token: 1234567899b95cd24c3e91d210388a28bf560b73
✓ Logged in to github.com account cgrindel (keyring)
- Active account: true
- Git operations protocol: ssh
- Token: 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
- Token scopes: 'admin:public_key', 'gist', 'read:org', 'repo'
"

expected="cgrindel"
Expand Down

0 comments on commit 96e82a2

Please sign in to comment.