Created
April 18, 2022 19:16
-
-
Save tmclnk/8fb4b239a2fbe72c8760a02e0cde3a64 to your computer and use it in GitHub Desktop.
dump latest hash
This file contains hidden or 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 | |
github_pat=$(bw get password "github pat") | |
owner=dmsi-io | |
branch=develop | |
declare -A repos | |
repos[accounts-receivable-api]=develop | |
repos[users-api]=develop | |
repos[session-api]=develop | |
repos[houston-api-docs]=main | |
for entry in ${!repos[@]}; do | |
repo=$entry | |
branch="${repos[$entry]}" | |
hash=$(curl -s -H "Authorization: token $github_pat" \ | |
-H "Accept: application/vnd.github.v3.sha" \ | |
"https://api.github.com/repos/$owner/$repo/commits/$branch") | |
jq -n --arg repo "$repo" --arg hash "$hash" --arg short "${hash:0:7}" \ | |
'{ "repo":$repo, "hash":$hash, short:$short }' | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment