kiegroup / mock-github

A library to create a local github environment and easily mock github APIs using an octokit like interface
Apache License 2.0
61 stars 5 forks source link

Ability to switch branches? #71

Closed JoshMcCullough closed 1 year ago

JoshMcCullough commented 1 year ago

Feature request It'd be great if we could have the ability to switch branches e.g. gh.repo.checkout('myRepo', 'myBranch'). Maybe this is just useful for me but in my case I need to be able to check if an action did the right thing based on the branch it was working against. E.g. if it is running against the "qa" branch, then it should push package to the QA repo.

Currently I can do this by setting up a separate MockGithub instance for each branch I need to test. But it'd be a bit more convenient to be able to set up the GH mock once and then switch branches at the start of each test case.

shubhbapna commented 1 year ago

Gotcha, make sense. I will add it soon

shubhbapna commented 1 year ago

@JoshMcCullough let me know if this implementation works for you: https://github.com/kiegroup/mock-github/pull/73

It will throw an error if the repository and the branch do not exist