@@ -243,6 +243,68 @@ source {
243243 })
244244 })
245245
246+ t .Run ("validates_that_source_is_not_set_for_workflow_build_type" , func (t * testing.T ) {
247+ randomID := acctest .RandString (5 )
248+ repoName := fmt .Sprintf ("%spages-%s" , testResourcePrefix , randomID )
249+
250+ config := fmt .Sprintf (`
251+ resource "github_repository" "test" {
252+ name = "%s"
253+ visibility = "%s"
254+ auto_init = true
255+ }
256+
257+ resource "github_repository_pages" "test" {
258+ repository = github_repository.test.name
259+ build_type = "workflow"
260+ source {
261+ branch = "main"
262+ path = "/"
263+ }
264+ }
265+ ` , repoName , testAccConf .testRepositoryVisibility )
266+
267+ resource .Test (t , resource.TestCase {
268+ PreCheck : func () { skipUnauthenticated (t ) },
269+ ProviderFactories : providerFactories ,
270+ Steps : []resource.TestStep {
271+ {
272+ Config : config ,
273+ ExpectError : regexp .MustCompile (`'source' is not supported for workflow build type` ),
274+ },
275+ },
276+ })
277+ })
278+
279+ t .Run ("validates_that_source_is_set_for_legacy_build_type" , func (t * testing.T ) {
280+ randomID := acctest .RandString (5 )
281+ repoName := fmt .Sprintf ("%spages-%s" , testResourcePrefix , randomID )
282+
283+ config := fmt .Sprintf (`
284+ resource "github_repository" "test" {
285+ name = "%s"
286+ visibility = "%s"
287+ auto_init = true
288+ }
289+
290+ resource "github_repository_pages" "test" {
291+ repository = github_repository.test.name
292+ build_type = "legacy"
293+ }
294+ ` , repoName , testAccConf .testRepositoryVisibility )
295+
296+ resource .Test (t , resource.TestCase {
297+ PreCheck : func () { skipUnauthenticated (t ) },
298+ ProviderFactories : providerFactories ,
299+ Steps : []resource.TestStep {
300+ {
301+ Config : config ,
302+ ExpectError : regexp .MustCompile (`'source' is required for legacy build type` ),
303+ },
304+ },
305+ })
306+ })
307+
246308 t .Run ("imports_pages_configuration" , func (t * testing.T ) {
247309 randomID := acctest .RandString (5 )
248310 repoName := fmt .Sprintf ("%spages-%s" , testResourcePrefix , randomID )
0 commit comments