I'm getting this error from TravisCI when it tries to run a Pull Request
coveralls.exception.CoverallsException: Not on TravisCI. You have to provide either repo_token in .coveralls.yml or set the COVERALLS_REPO_TOKEN env var. The command "docker-compose -f docker-compose.yml -f docker-compose.override.yml run -e COVERALLS_REPO_TOKEN web sh -c "coverage run ./src/manage.py test src && flake8 src && coveralls"" exited with 1.
However, I do have both COVERALLS_REPO_TOKEN
and repo_token
set as environment variables in my TravisCI, and I know they're correct because TravisCI passes my develop branch and successfully sends the results to coveralls.io:
OK
Destroying test database for alias 'default'...
Submitting coverage to coveralls.io...
Coverage submitted!
Job ##40.1
https://coveralls.io/jobs/61852774
The command "docker-compose -f docker-compose.yml -f docker-compose.override.yml run -e COVERALLS_REPO_TOKEN web sh -c "coverage run ./src/manage.py test src && flake8 src && coveralls"" exited with 0.
How do I get TravisCI to recognize my COVERALLS_REPO_TOKEN for the pull requests it runs?
Found the answer: You can't! At least not while keeping your coveralls.io token secret, because:
Defining encrypted variables in .travis.yml
Encrypted environment variables are not available to pull requests from forks due to the security risk of exposing such information to unknown code.
Defining Variables in Repository Settings
Similarly, we do not provide these values to untrusted builds, triggered by pull requests from another repository.