Skip to content

Instantly share code, notes, and snippets.

@StartAutomating
Created November 28, 2025 22:30
Show Gist options
  • Select an option

  • Save StartAutomating/d65a89645446d7835803193300d52e50 to your computer and use it in GitHub Desktop.

Select an option

Save StartAutomating/d65a89645446d7835803193300d52e50 to your computer and use it in GitHub Desktop.
Gist get me a GitHub User's BlueSky profile
<#
.SYNOPSIS
Get a GitHub user's BlueSky
.DESCRIPTION
Gets an At Protocol Handle / BlueSky profile link for a GitHub user
.EXAMPLE
./GitHubBlueSky StartAutomating
#>
param([string]$UserName)
# Globally cache to avoid repeat request (use script: inside of a function or module)
if (-not $global:GitHubProfileCache) {
$global:GitHubProfileCache = [Ordered]@{}
}
# Get the user profile
if (-not $global:GitHubProfileCache[$UserName]) {
$global:GitHubProfileCache[$UserName] = Invoke-WebRequest "https://github.com/$UserName"
}
# Skip empty entries
if (-not $global:GitHubProfileCache[$UserName]) { return }
$blueSkyProfile = ($global:GitHubProfileCache[$UserName].Links -match 'bsky' | Select-Object -ExpandProperty Href)
# If we have a bluesky profile
if ($blueSkyProfile) {
# output an object linking the profiles
[PSCustomObject]@{
GitUserName = $UserName
GitHubProfile = "https://github.com/$UserName"
# and extract the username from the last segment
AtUserName = ($blueSkyProfile -as [uri]).Segments[-1] -replace '/'
BlueSkyProfile = $blueSkyProfile
}
} else {
# Otherwise, just output the git info
[PSCustomObject]@{
GitUserName = $UserName
GitHubProfile = "https://github.com/$UserName"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment