github-go-version <owner>/<repo> <commit>
Created
January 28, 2021 14:31
-
-
Save dolmen/452014dd251d173f65c6d437885206c6 to your computer and use it in GitHub Desktop.
Get Go module+version string from a commit from GitHub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# user/repo | |
user_repo="$1" | |
commit="$2" | |
date="$(curl -s -X GET -H "Cache-Control: no-cache" -L https://api.github.com/repos/"$user_repo"/commits/"$commit" | jq -r '.commit.committer.date | gsub("[^0-9]"; "")' )" | |
echo "github.com/[email protected]$date-${commit%????????????????????????????}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment