Created
September 7, 2018 02:01
-
-
Save dontfight/7cb75e4358891f2fb4346d5132df00da to your computer and use it in GitHub Desktop.
Get latest commit sha
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
| declare -A REPOS | |
| GITLAB_URL=${1:-https://gitlab.example.com} | |
| TARGET=${2:-master} | |
| REPOS[admin]=8 | |
| REPOS[api]=9 | |
| REPOS[application]=31 | |
| REPOS[auth]=15 | |
| REPOS[cardstore]=27 | |
| REPOS[composer]=29 | |
| REPOS[dashboard]=11 | |
| REPOS[drug]=14 | |
| REPOS[elastic]=30 | |
| REPOS[email]=22 | |
| REPOS[event]=28 | |
| REPOS[healthchain-loader]=37 | |
| REPOS[healthchain-prescription]=19 | |
| REPOS[location]=23 | |
| REPOS[sig]=33 | |
| REPOS[standalone]=24 | |
| REPOS[terminology]=18 | |
| REPOS[user]=16 | |
| for project_id in "${!REPOS[@]}"; | |
| do | |
| PROJECT=$(curl -sS --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$GITLAB_URL/api/v4/projects/${REPOS[$project_id]}/repository/commits?ref_name=$TARGET" | grep -Eo -m 1 '"id":.*?[^\\]",' | awk -F':' '{print substr($2,2,6)}'| head -1) | |
| echo "$project_id => $PROJECT"; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment