Build job failing for unknown reason

I have configured two identical build jobs for my GitHub repo. The issue in my case is that only one build succeeds while the other fails on the exact same command. The command is simply an API request to GitHub. What is the cause of this failure?

Here’s the code snippet which is failing:

- "if [ $latest == 'true' ]; then\n  link=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest
  | grep \"/hugo_[0-9]\\.[0-9]*\\.*[0-9]_Linux-64bit.tar.gz\" | cut -d\\\" -f4)\nelse \n  link=\"https://github.com/gohugoio/hugo/releases/download/v${minVer}/hugo_${minVer}_Linux-64bit.tar.gz\"\nfi\n"
- wget $link -O hugo.tgz

Basically, $link is successfully declared in one job, while it isn’t in the other job. When $link is empty, the wget command fails and hence the build job as well.

Here are the necessary links:

You are making an anonymous GitHub API call. Such calls are limited to 60 requests per hour on all of Travis CI (because our builds share a limited number of IP addresses). I suggest adding your own API token to raise the limit to 5000/hour. https://developer.github.com/v3/auth/

1 Like

Thanks, that worked. I had already added the API token but didn’t include it in the request.