Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying branch protection from one branch to another #1593

Open
mdeggies opened this issue Aug 6, 2020 · 1 comment
Open

Copying branch protection from one branch to another #1593

mdeggies opened this issue Aug 6, 2020 · 1 comment

Comments

@mdeggies
Copy link

@mdeggies mdeggies commented Aug 6, 2020

Hello! I'm attempting to copy a *github.Protection from one branch to another. This involves turning the existing *github.Protection into a *github.ProtectionRequest to use in the UpdateBranchProtection() method. Is there a recommended way to do this?

I have a monster of a function that tries to convert an existing Protection into a ProtectionRequest, but there's lots of nested requests needed, and any nil from Protection that's copied over throws an error.

@gmlewis
Copy link
Collaborator

@gmlewis gmlewis commented Aug 6, 2020

To debug things like this, I usually try to make a working example with curl and then convert it to the Go equivalent. Is that easy to do in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.