Skip to content

Instantly share code, notes, and snippets.

@coip
Last active January 18, 2020 04:05
Show Gist options
  • Save coip/2371ef653b4a57479b0cdfd76c1751c9 to your computer and use it in GitHub Desktop.
Save coip/2371ef653b4a57479b0cdfd76c1751c9 to your computer and use it in GitHub Desktop.
gets latest go.mod
#!/bin/sh
raw=$(curl -s -H "Authorization: token $PAT" https://api.github.com/repos/$1/$2/contents/go.mod \
| grep -o "https://raw.*token=[a-zA-Z0-9]*")
curl -s "${raw}"
@coip
Copy link
Author

coip commented Jan 17, 2020

quick n dirty cli usage: PAT=$TOKEN ./getgomod.sh $ORG $REPO
note: place a space at the start of line to prevent committing PAT to history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment