Repository navigation
Add checks field to RequiredStatusChecks - #2276
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2276 +/- ##
=======================================
Coverage 97.81% 97.81%
=======================================
Files 114 114
Lines 10266 10266
=======================================
Hits 10042 10042
Misses 156 156
Partials 68 68
Continue to review full report at Codecov.
|
gmlewis
requested changes
Jan 29, 2022
gmlewis
left a comment
Collaborator
There was a problem hiding this comment.
Thank you, @k24dizzle !
Just a couple tweaks, please.
Collaborator
|
It looks like the linter has a couple issues as well. |
in RequiredStatusChecksRequest
gmlewis
approved these changes
Jan 31, 2022
gmlewis
left a comment
Collaborator
There was a problem hiding this comment.
Thank you, @k24dizzle !
LGTM.
Merging.
jlaportebot
added a commit
to jlaportebot/go-github
that referenced
this pull request
Jun 28, 2026
11 of 20 tasks
Equinxe
added a commit
to Equinxe/AI_Enginering
that referenced
this pull request
Nov 4, 2026
…und 2 left untested Review round 3 of PR #460 at 23e4dc0 (QA Engineer, Code Reviewer R2-C1, R2-C2, R2-M1, R2-m1; Security Engineer's non-blocking points). Every branch PUT sent required_status_checks with both contexts and checks. GitHub refuses that body: google/go-github#2276 ("If you provide both or neither, you will get an Invalid Request error") and #2976 (a raw PUT refused with both, accepted with checks alone), and sigmavirus24/github3.py#1112 (422, more than one subschema in oneOf matched). On a real repository the script would have protected nothing. The body now sends checks alone. The REST docs give contexts a "Closing down notice" and say to use checks instead (Update branch protection, required_status_checks). A check with no app_id gets the app GitHub selects, as contexts would. Both fake gh now refuse a branch protection PUT that holds both lists or neither, with a 422 as GitHub does, and the case that pinned both lists now pins checks alone. Guards no case could fail now have one (R2-M1): an answer jq cannot read, for the repository, the GitHub Actions app, a protection, the ruleset list (which would otherwise create a second ruleset after main and develop were written), the read-back of the required checks and that of automatic head-branch deletion; a failed read-back of automatic head-branch deletion; an Actions app id that is not an integer; a check sent as any app (-1) that comes back with no app, and one that comes back tied to an app. The Requires line, README.md, Workflows/PROJECT_BOOTSTRAP.md Step 2 and the missing-jq message name jq and say how to install it; Git for Windows does not include it. When the read-back after a PUT stops the run, the message says that branch's new protection is already written, and to check and restore it in Settings > Branches. Red: on 23e4dc0's script, 56 of the 130 checks of this file's first round-3 version fail, every run stopping on the fake's 422 for both lists. Mutant X01, which sends contexts beside checks again, fails 38 of 46 the same way. Each guard R2-M1 lists, removed alone, is caught by its new case (Y03, Y04, Y09, Y09b, Y25 to Y30), as are the jq and read-back message mutants (X02, X03). Green: the full set no longer fits 600 s on this machine, so it ran in two halves, 95 and 54 checks passed, and the WU-IAENG-384 cases passed before the limit. RISK: GitHub refuses the PUT body with checks alone, which no case can show without writing to a real repository | tier=Medium | mitigation=checks is the non-deprecated form in the REST docs, and the go-github #2976 reproduction shows it accepted; a refused write stops the run before any other write and names what was applied | decided_by=self Work Unit: WU-IAENG-433 Employee: DevOps Engineer Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempt to solve #2274.
From my own experimentation, I discovered that there's two ways that this
Checksfield can be used to update the required status checks for a protected branch:ProtectionRequest->RequiredStatusChecks->RequiredStatusCheckstruct, in this API call we must provide either one ofChecksorContexts(the other must benil) inRequiredStatusChecksto successfully update a branch protection. If you provide both or neither, you will get anInvalid Requesterror.RequiredStatusChecksRequest->RequiredStatusCheckstruct, in this API callChecksandContextsare both optional fields, if you provide both of them onlyCheckswill be used to update the status checks.