simonw / github-contents

Python class for reading and writing data to a GitHub repository
19 stars 3 forks source link

Reads are hard-coded to master (not main) #5

Open simonw opened 3 years ago

simonw commented 3 years ago

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

simonw commented 3 years ago

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

simonw commented 3 years ago

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"
        ]