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

Don't attempt to push on builds from forks #332

Closed asmeurer closed 5 years ago

asmeurer commented 5 years ago

Travis does not make encrypted environment variables available to forks, so doctr should not attempt to push from them.

I have to check this with the GitHub API, so hopefully that doesn't cause issues.

Fixes #110 Closes #331 Closes #236

asmeurer commented 5 years ago

The tests are on my fork. https://travis-ci.org/asmeurer/doctr/builds/443414925. It looks like there are some other issues because the doctr tests weren't designed to run on a fork build.

asmeurer commented 5 years ago

Looks like the API checks fail pretty regularly because of API limits. I'm not sure how feasible this fix is.

asmeurer commented 5 years ago

We do call doctr a lot in our tests (13 tests * 2 Python versions per build), and GitHub's unauthenticated rate limite is 60 requests per hour. I don't know how that ends up being split up on Travis, but assuming that each fork gets its own IP most likely most forks wouldn't hit this issue very often.

asmeurer commented 5 years ago

We can print a warning, but I'm not too happy with that, as it could confuse people. Is there really not a way to check this without using the API?

asmeurer commented 5 years ago

This also contains a minor fix for syncing a single file when the deploy directory doesn't already exist (it came up because my fork has an old copy of gh-pages).

asmeurer commented 5 years ago

Going to try this. If the API call fails, it assumes that it isn't on a fork, so it may still fail on forks sometimes (or print a warning message on non-forks).

I've also got some fixes to single-file syncs which came up on my fork https://travis-ci.org/asmeurer/doctr/branches. If we do end up reverting this we should try to keep those fixes intact.