try to add in a repo privacy check #13
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Was using the new ottrpal::borrow_chapter in place of the old cow::borrow_chapter and got an error because it expected a token. Hadn't passed one because the documentation made me think I only needed to if I was grabbing content from a private repo (and typically my use cases for borrow_chapter don't). So tried to adjust the logic in the
check_git_repofunction thatborrow_chapterwas using so that if the token was NULL and the repo was private, then it would look for a token.To test if a repo was private, I was using the GItHub API (gh) and grabbing the repo_info. I tried to add in some error handling (wrapping the gh request in a try) in case for some reason we didn't have high enough permissions to be looking into whatever repo it was or the repo name had a typo or what have you. So that's the nested if looking at the repo_info output. If it failed, I knew the repo_info$private wouldn't be accessible and would fail when I added that to the condition checking if the token is NULL.
When testing this, I found that the grepl line errored because if it was a public repo, then the !grepl... was logical(0). So added an
isTRUEto maintain the expected function.Now, my tests are failing with a sink() issue.

I tried to add debugging messages with the message function to the overall borrow_chapter function to see where it is failing, but they didn't display in the logs in my latest test.