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

Handle PR statuses when setting branch protection rules #1644

Merged

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Nov 14, 2023

The GH API returns both Protection.RequiredStatusChecks.Contexts which
is deprecated and Protection.RequiredStatusChecks.Checks which is
supposed to be used now on GET, but the PUT update needs to only set one
or the other.

Let's filter out the deprecated field so that setting branch protection
rules when commit statuses are in place works fine.

Fixes: #1596

The GH API returns both `Protection.RequiredStatusChecks.Contexts` which
is deprecated and `Protection.RequiredStatusChecks.Checks` which is
supposed to be used now on GET, but the PUT update needs to only set one
or the other.

Let's filter out the deprecated field so that setting branch protection
rules when commit statuses are in place works fine.

Fixes: mindersec#1596
@jhrozek jhrozek merged commit 6274d1c into mindersec:main Nov 14, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

branch protection remediation has issues when an existing branch protection contains a status check
3 participants