Created
May 17, 2019 04:27
-
-
Save hiiamyes/e1986049a1e43f229161b56c23f551c5 to your computer and use it in GitHub Desktop.
get build number
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
# brew install jq | |
#!/bin/sh | |
commit_sha=$(curl -s "https://api.github.com/repos/hiiamyes/repo/branches/develop" \ | |
-H 'Authorization: token {token}' | | |
jq -r '.commit.sha') | |
tag_name=$(curl -s "https://api.github.com/repos/hiiamyes/repo/tags" \ | |
-H 'Authorization: token {token}' | | |
jq -r --arg commit_sha $commit_sha '.[] | select(.commit.sha == $commit_sha) | .name') | |
build_number=${tag_name/build-/} | |
build_number=${build_number/.1/} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment