当 dockerized django 应用程序在 TravisCI 中为 运行 时,工作服无法识别令牌,但仅来自拉取请求

coveralls doesn't recognize token when dockerized django app is run in TravisCI, but only from pull requests

当它尝试 运行 拉取请求时,我收到 this error from TravisCI

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.

但是,我确实在我的 TravisCI 中将 COVERALLS_REPO_TOKENrepo_token 设置为环境变量,我知道它们是正确的,因为 TravisCI passes my develop branch 并成功将结果发送到 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.

如何让 TravisCI 识别我的 COVERALLS_REPO_TOKEN 拉取请求 运行s?

找到答案:不能!至少在保密您的 coveralls.io 令牌时不会,因为:

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.