infra: travis: jq tools usage for json parsing after curl

This commit is contained in:
Roman Ivanov 2016-02-22 15:17:38 -08:00
parent 9f297297b7
commit 7a08d903ce
1 changed files with 3 additions and 3 deletions

View File

@ -297,13 +297,13 @@ matrix:
- DESC="test Issue ref in PR description"
- CMD0="if [[ ! $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
- CMD1=" && LINK_COMMITS=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST/commits "
- CMD2=" && COMMITS=\$(curl -s -i -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | grep message) "
- CMD2=" && COMMITS=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
- CMD3=" && echo 'Messages from github:'\$COMMITS "
- CMD4=" && ISSUE_NUMBER=\$( echo \$COMMITS | head -n 1 | sed -e 's/^.*Issue //' | sed -e 's/:.*//') "
- CMD4=" && ISSUE_NUMBER=\$( echo \$COMMITS | sed -e 's/^.*Issue //' | sed -e 's/:.*//') "
- CMD5=" && echo 'Issue number:'\$ISSUE_NUMBER "
- CMD6=" && if [[ \$ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then "
- CMD7=" LINK_PR=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST "
- CMD8=" && RESULT=\$(curl -s -i -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_PR | grep body | grep \$ISSUE_NUMBER) "
- CMD8=" && RESULT=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_PR | jq '.body' | grep \$ISSUE_NUMBER) "
- CMD9=" && echo 'PR Description grepped:'\$RESULT "
- CMD10=" && if [[ -z \$RESULT ]]; then exit 1; fi "
- CMD11=" fi "