Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d6770b4
Refactor tests to use testing plugin
deiga Mar 27, 2026
dd5cbee
Refactor to use `tflog`
deiga Mar 28, 2026
50eadb2
Remove gate for `archived` repos in Read.
deiga Mar 28, 2026
746a1ec
Refactor to no longer call CRUD methods directly
deiga Mar 28, 2026
5cd4dbb
Enable parallel testing
deiga Mar 28, 2026
14e1cfe
Reduce to using a single `d.SetId` in `Create`
deiga Mar 28, 2026
3b38aa4
Remove unnecessary copy-pasta
deiga Mar 28, 2026
b0a2f63
Minor cleanup
deiga Mar 28, 2026
4da5edc
Add missing field to repo DS
deiga Mar 29, 2026
02a431c
Update docs
deiga Mar 29, 2026
ec891a7
Add validation for merge and squash merge configs
deiga Mar 29, 2026
2fb5d9a
Refactor to use only `CustomizeDiff` for validation
deiga Mar 29, 2026
4aa9854
Improve structure of `setResourceFieldsFromRepo`
deiga Mar 29, 2026
6869d9b
Cleaning some tests
deiga Mar 30, 2026
aa38b67
Enable primary_language test
deiga Mar 30, 2026
9d9f02e
Fix linter issues
deiga Jul 10, 2026
63a7862
Update docs to use generated content
deiga Jul 10, 2026
c6c537f
Fix docs check
deiga Jul 10, 2026
9c062b4
Fix duplicate resource naming
deiga Jul 10, 2026
c7e5946
Remove all calls to `resource.ParallelTest`
deiga Jul 10, 2026
67988b3
Try to ensure test is not flaky
deiga Jul 10, 2026
a997f05
Rename tests to snake case
deiga Jul 10, 2026
cfe512c
Address review comments
deiga Jul 10, 2026
3918165
Update docs for repository data-source
deiga Jul 11, 2026
a4a21f8
Refactor `errors.As` to `errors.AsType`
deiga Jul 11, 2026
ebf7338
Add test helper for creating template repositories
deiga Jul 12, 2026
5c0512b
Fix config indentation
deiga Jul 12, 2026
f02ad1c
Add retry to the Edit API call in `Create`
deiga Jul 12, 2026
99f8011
Deletes `primary_language` test as it mainly tests API functionality,…
deiga Jul 12, 2026
8581e2c
Add helper for temporarily disabling forking
deiga Jul 12, 2026
3e7bb4a
Address linter issues
deiga Jul 12, 2026
4213438
Add missing doc update
deiga Jul 13, 2026
d382d8f
Ensure that Org setting modifying tests don't run in parallel
deiga Jul 13, 2026
070ed3d
Address copilot comment
deiga Jul 14, 2026
26d32ac
Modernize repository Data Source tests
deiga Jul 14, 2026
a86c1b7
Address possible edge-case if either `allow_` settings value is not k…
deiga Jul 14, 2026
2ba7b9a
Ensure all fields are documented
deiga Jul 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test:
testacc:
@branch=$$(git rev-parse --abbrev-ref HEAD); \
printf "==> Running acceptance tests on branch: \033[1m%s\033[0m...\n" "🌿 $$branch 🌿"
TF_ACC=1 CGO_ENABLED=0 go test $(TESTACC) -v -run '^TestAcc' $(RUNARGS) $(TESTARGS) -timeout 120m -count=1
TF_ACC=1 CGO_ENABLED=0 go test $(TESTACC) -parallel=4 -v -timeout 120m -count=1 -run '^TestAcc' $(RUNARGS) $(TESTARGS)

sweep:
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
Expand Down
4 changes: 2 additions & 2 deletions RESOURCES.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The overall status of each resource or data source is captured in this document
| `github_release` | ⚠️ | ✅ | ❓ | ❓ | ❓ | ❓ |
| `github_release_asset` | ⚠️ | ✅ | ❓ | ❓ | ❓ | ❓ |
| `github_repositories` | ⚠️ | ✅ | ❓ | ❓ | ❓ | ❓ |
| `github_repository` | ⚠️ | ✅ | | | | |
| `github_repository` | | ✅ | | | | |
| `github_repository_autolink_references` | ⚠️ | ✅ | ❓ | ❓ | ❓ | ❓ |
| `github_repository_branches` | ⚠️ | ✅ | ❓ | ❓ | ❓ | ❓ |
| `github_repository_custom_properties` | ⚠️ | ✅ | ❓ | ❓ | ❓ | ❓ |
Expand Down Expand Up @@ -179,7 +179,7 @@ The overall status of each resource or data source is captured in this document
| `github_project_card` (🚫) | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_project_column` (🚫) | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_release` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| `github_repository` | | | | | | | |
| `github_repository` | | | | | | | |
| `github_repository_autolink_reference` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_repository_collaborator` | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
| `github_repository_collaborators` | ⚠️ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
Expand Down
349 changes: 237 additions & 112 deletions docs/data-sources/repository.md

Large diffs are not rendered by default.

261 changes: 132 additions & 129 deletions docs/resources/repository.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/resources/github_repository/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import github_repository.terraform myrepo
85 changes: 85 additions & 0 deletions github/acc_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,35 @@ func mustCreateTestRepository(t *testing.T) *github.Repository {
return repo
}

func mustCreateTemplateRepository(t *testing.T) *github.Repository {
t.Helper()

randomID := acctest.RandString(testRandomIDLength)
name := fmt.Sprintf("%stemplate-%s", testResourcePrefix, randomID)

req := &github.Repository{
Name: &name,
AutoInit: new(true),
IsTemplate: new(true),
}

repo, _, err := testAccConf.meta.v3client.Repositories.Create(t.Context(), testAccConf.meta.name, req)
if err != nil {
t.Fatalf("failed to create template repository: %v", err)
}

t.Cleanup(func() {
if _, err := testAccConf.meta.v3client.Repositories.Delete(context.Background(), testAccConf.meta.name, name); err != nil {
if err, ok := errors.AsType[*github.ErrorResponse](err); ok && err.Response.StatusCode == 404 {
return
}
t.Logf("failed to delete template repository %s: %v", name, err)
}
})

return repo
}

func mustRenameTestRepository(t *testing.T, repo *github.Repository, newName string) {
t.Helper()

Expand Down Expand Up @@ -602,3 +631,59 @@ func mustUpdateRepositoryDependabotSecret(t *testing.T, repo *github.Repository,
t.Fatalf("failed to update test repository dependabot secret: %v", err)
}
}

func mustDisableForkingForOrganization(t *testing.T, orgName string) {
t.Helper()

currentSettings, _, err := testAccConf.meta.v3client.Organizations.Get(t.Context(), orgName)
if err != nil {
t.Fatalf("failed to get current organization settings for %s: %v", orgName, err)
}

if currentSettings.GetMembersCanForkPrivateRepos() == false {
return
}

orgSettingsReq := &github.Organization{
MembersCanForkPrivateRepos: new(false),
}

_, _, err = testAccConf.meta.v3client.Organizations.Edit(t.Context(), orgName, orgSettingsReq)
if err != nil {
t.Fatalf("failed to update organization settings for %s: %v", orgName, err)
}

t.Cleanup(func() {
if _, _, err := testAccConf.meta.v3client.Organizations.Edit(context.WithoutCancel(t.Context()), orgName, &github.Organization{MembersCanForkPrivateRepos: new(true)}); err != nil {
t.Logf("failed to reset organization setting for %s: %v", orgName, err)
}
})
}

func mustRequireWebCommitSignoffForOrganization(t *testing.T, orgName string) {
t.Helper()

currentSettings, _, err := testAccConf.meta.v3client.Organizations.Get(t.Context(), orgName)
if err != nil {
t.Fatalf("failed to get current organization settings for %s: %v", orgName, err)
}

if currentSettings.GetWebCommitSignoffRequired() == true {
return
}

orgSettingsReq := &github.Organization{
WebCommitSignoffRequired: new(true),
}

_, _, err = testAccConf.meta.v3client.Organizations.Edit(t.Context(), orgName, orgSettingsReq)
if err != nil {
t.Fatalf("failed to update organization settings for %s: %v", orgName, err)
}

t.Cleanup(func() {
if _, _, err := testAccConf.meta.v3client.Organizations.Edit(context.WithoutCancel(t.Context()), orgName, &github.Organization{WebCommitSignoffRequired: new(false)}); err != nil {
t.Logf("failed to reset organization setting for %s: %v", orgName, err)
}
})
}
Loading
Loading