ginolhac / upnews

Display news and update outdated github R packages
Other
25 stars 2 forks source link

Method to validate a branch for a repo #6

Closed pvictor closed 6 years ago

pvictor commented 6 years ago

Hi!

Very useful package :) I had an error with a branch that no longer exists in a repository, maybe linked to #5 . So I added a function to check if the branch exist in the repo, and if it doesn't fall back to a branch by default (the first one returned by API, maybe there's something better to do...). Now that's work for me.

And I put in some extra requireNamespace for the add-in.

Victor

ginolhac commented 6 years ago

Nice thanks ! First time I am receiving a PR ;) nice addition, I haven't though of this issue, branch that does exist remotely. It is not related to #5 which was when the ref is a commit not a branch. But actually, I think your validate_branch() should be in the else statement of gh_fix_ref(). Since if the ref is a commit, I loop over the remote branch, else I just return the local ref. Then you could had your validate_branche() there. That will avoid some queries since this step is before retrieving all the news, date, last commit etc.... What do you think?

Also, could you add yourself in the DESCRIPTION file?

pvictor commented 6 years ago

Aaah cool :D

Yes good idea, i put the call to validate_branch in gh_fix_ref, that's better.

And added warn = FALSE in readLines to avoid warnings if missing EOL.