github-contents icon indicating copy to clipboard operation
github-contents copied to clipboard

Reads are hard-coded to master (not main)

Open simonw opened this issue 4 years ago • 2 comments

You can't even read content from the main branch at the moment. Relates to #3.

simonw avatar Feb 24 '21 18:02 simonw

Should also detect the principal branch on a repo if you don't specify one.

simonw avatar Feb 24 '21 18:02 simonw

Here's a method that can detect the default branch (using a JSON key that was added to GitHub at some point since I last recorded the betamax cassettes in this repo):

    def detect_default_branch(self):
        return self.session.get(self.base_url(), headers=self.headers()).json()[
            "default_branch"
        ]

simonw avatar Feb 24 '21 18:02 simonw