samvera-labs / huborg

Script interactions with repositories within an organization (or organizations).
Apache License 2.0
2 stars 0 forks source link

Favoring default_branch instead of "master" #15

Closed jeremyf closed 4 years ago

jeremyf commented 4 years ago

First, "master" is a lazy assumption. Github supports a default branch, which at the time of writing assumes "master". However, the default of "master" may not be the case.

Instead, this change now checks with the repository: "What is your default branch?" From that default branch Huborg creates pull requests. The default_branch is an attribute on the repository object (as per documentation).

Note, I discovered this when I ran Samvera's maintenance script to push up our recent changes to Samvera's Contributing document. See samvera/maintenance#44.


Octokit::NotFound: GET
https://api.github.com/repos/samvera-labs/sufia.io/git/refs/heads/master:
404 - Not Found // See:
https://developer.github.com/v3/git/refs/#get-a-reference