drdoctr / doctr

A tool for automatically deploying docs from Travis CI to GitHub pages.
https://drdoctr.github.io
MIT License
107 stars 30 forks source link

Syncing a fork gives DOCTR_DEPLOY_ENCRYPTION_KEY error #331

Closed mattjshannon closed 5 years ago

mattjshannon commented 6 years ago

Hello, this is my first time raising an issue, so apologies if I missed something from the API that answers this.

Essentially, I have forked a repo that uses doctr to deploy their documentation to github-pages via Travis. The upstream repo is https://github.com/PAHdb/pyPAHdb, and my fork is https://github.com/mattjshannon/pyPAHdb.

When I sync my fork (master) to the upstream (master) after an accepted PR, Travis attempts a build and then fails with the following output:

(from https://travis-ci.org/mattjshannon/pyPAHdb/builds/443311254)

$ doctr deploy --built-docs docs/build/html .
Setting git attributes
git config --global user.name 'Doctr (Travis CI)'
git config --global user.email drdoctr@users.noreply.github.com
Adding doctr remote
ERROR: The doctr command '/home/travis/virtualenv/python3.6.3/bin/doctr deploy --built-docs docs/build/html .' failed: RuntimeError('DOCTR_DEPLOY_ENCRYPTION_KEY_MATTJSHANNON_PYPAHDB or DOCTR_DEPLOY_ENCRYPTION_KEY environment variable is not set',)

When I create branches and make pull requests against the upstream repo the build has no trouble, so I'm not sure why it fails when just syncing the fork to upstream.

Any help would be greatly appreciated. Thank you!

asmeurer commented 6 years ago

This is the same issue as https://github.com/drdoctr/doctr/issues/236 (I think), and https://github.com/drdoctr/doctr/issues/110.

The issue is that Travis doesn't support encrypted environment variables on forked repos. We aren't detecting this properly so it gives an error. By default, doctr only tries to deploy from master, which is why you only see it when you update your master branch.

mattjshannon commented 6 years ago

This is the same issue as #236 (I think), and #110.

The issue is that Travis doesn't support encrypted environment variables on forked repos. We aren't detecting this properly so it gives an error. By default, doctr only tries to deploy from master, which is why you only see it when you update your master branch.

Thanks for the explanation, that makes sense. Is it something I should just ignore or is there a work-around? I saw in the API it suggests having a separate source branch, such that master only receives the built files (on the upstream repo; the link was around somewhere...). Would that avoid this issue on my fork? Thanks again!

asmeurer commented 6 years ago

For now you should ignore it. This is something that we need to fix in doctr.

I saw in the API it suggests having a separate source branch, such that master only receives the built files (on the upstream repo; the link was around somewhere...).

This is only for user.github.io repos. That should perhaps be clearer in the docs.

asmeurer commented 6 years ago

How can we tell if a repo is a fork on Travis? I don't see any Travis environment variables that would indicate it. Maybe we have to check using the GitHub API.

mattjshannon commented 6 years ago

Thanks for your help! Much appreciated.