Skip to content

Instantly share code, notes, and snippets.

@amatkivskiy
Created August 16, 2017 12:07
Show Gist options
  • Save amatkivskiy/3b16617c2cd4027f90e4882fa21488d3 to your computer and use it in GitHub Desktop.
Save amatkivskiy/3b16617c2cd4027f90e4882fa21488d3 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ -z "${CI_PULL_REQUEST}" ]]; then
echo "---> Making build outside of Pull Request (building single commit or branch)"
./gradlew gnagCheck
else
echo "---> Making build for Pull Request"
# In the env variable CI_PULL_REQUEST CircleCI provides the URL of the PR (like https://github.com/amatkivskiy/sample/pull/3)
# But for the Gnag task we need PR number (simply 3)
# ${CI_PULL_REQUEST##*/} means that we simply get '3' from the URL provided in CI_PULL_REQUEST/
./gradlew gnagReport -PauthToken="${PR_BOT_AUTH_TOKEN}" -PissueNumber="${CI_PULL_REQUEST##*/}"
fi
@sukesh1989
Copy link

This helped me. Thank you!

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