@@ -154,6 +154,85 @@ func TestAccGithubBranchProtectionV3_conversation_resolution(t *testing.T) {
154154func TestAccGithubBranchProtectionV3_required_status_checks (t * testing.T ) {
155155 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
156156
157+ t .Run ("configures required status checks" , func (t * testing.T ) {
158+
159+ config := fmt .Sprintf (`
160+
161+ resource "github_repository" "test" {
162+ name = "tf-acc-test-%s"
163+ auto_init = true
164+ }
165+
166+ resource "github_branch_protection_v3" "test" {
167+
168+ repository = github_repository.test.name
169+ branch = "main"
170+
171+ required_status_checks {
172+ strict = true
173+ checks = [
174+ "github/foo",
175+ "github/bar:-1",
176+ "github:foo:baz:1",
177+ ]
178+ }
179+
180+ }
181+
182+ ` , randomID )
183+
184+ check := resource .ComposeAggregateTestCheckFunc (
185+ resource .TestCheckResourceAttr (
186+ "github_branch_protection_v3.test" , "required_status_checks.#" , "1" ,
187+ ),
188+ resource .TestCheckResourceAttr (
189+ "github_branch_protection_v3.test" , "required_status_checks.strict" , "true" ,
190+ ),
191+ resource .TestCheckResourceAttr (
192+ "github_branch_protection_v3.test" , "required_status_checks.checks.#" , "3" ,
193+ ),
194+ resource .TestCheckResourceAttr (
195+ "github_branch_protection_v3.test" , "required_status_checks.checks.0" , "github/foo" ,
196+ ),
197+ resource .TestCheckResourceAttr (
198+ "github_branch_protection_v3.test" , "required_status_checks.checks.1" , "github/bar" ,
199+ ),
200+ resource .TestCheckResourceAttr (
201+ "github_branch_protection_v3.test" , "required_status_checks.checks.2" , "github:foo:baz" ,
202+ ),
203+ )
204+
205+ testCase := func (t * testing.T , mode string ) {
206+ resource .Test (t , resource.TestCase {
207+ PreCheck : func () { skipUnlessMode (t , mode ) },
208+ Providers : testAccProviders ,
209+ Steps : []resource.TestStep {
210+ {
211+ Config : config ,
212+ Check : check ,
213+ },
214+ },
215+ })
216+ }
217+
218+ t .Run ("with an anonymous account" , func (t * testing.T ) {
219+ t .Skip ("anonymous account not supported for this operation" )
220+ })
221+
222+ t .Run ("with an individual account" , func (t * testing.T ) {
223+ t .Skip ("individual account not supported for this operation" )
224+ })
225+
226+ t .Run ("with an organization account" , func (t * testing.T ) {
227+ testCase (t , organization )
228+ })
229+
230+ })
231+ }
232+
233+ func TestAccGithubBranchProtectionV3_required_status_contexts (t * testing.T ) {
234+ randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
235+
157236 t .Run ("configures required status checks" , func (t * testing.T ) {
158237
159238 config := fmt .Sprintf (`
0 commit comments