Hillboy
Hillboy

Reputation: 695

Travis-Ci: Check if build is off push or pull request

I want to run a section of the script only when the build is off a push and not a PR. But on build it doesn't go. How can I only run the section when the build is off a push?

if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
setup_git
commit_website_files
publish_gh_pages
fi

Upvotes: 1

Views: 599

Answers (1)

Hillboy
Hillboy

Reputation: 695

Just use secure environment variables to determine if PR or push. Secure environment variables aren't available in push

if [ "${ghToken:-false}" != "false" ]; then
setup_git
commit_website_files
publish_gh_pages
fi

Upvotes: 1

Related Questions