Skip to content

Commit bedfb34

Browse files
committed
github_repository: Ensures that we don't try to PATCH an archived repo
Signed-off-by: Timo Sand <[email protected]>
1 parent b3ca429 commit bedfb34

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

github/resource_github_repository.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ func resourceGithubRepositoryUpdate(ctx context.Context, d *schema.ResourceData,
895895

896896
repoReq := resourceGithubRepositoryObject(d)
897897

898-
// handle visibility updates separately from other fields
898+
// handle visibility updates separately from other fields // TODO: Review if this behaviour is still needed
899899
repoReq.Visibility = nil
900900

901901
if !d.HasChange("security_and_analysis") {
@@ -983,7 +983,7 @@ func resourceGithubRepositoryUpdate(ctx context.Context, d *schema.ResourceData,
983983
}
984984
}
985985

986-
if d.HasChange("visibility") {
986+
if d.HasChange("visibility") && !d.Get("archived").(bool) {
987987
o, n := d.GetChange("visibility")
988988
repoReq.Visibility = github.Ptr(n.(string))
989989
log.Printf("[DEBUG] Updating repository visibility from %s to %s", o, n)
@@ -997,7 +997,7 @@ func resourceGithubRepositoryUpdate(ctx context.Context, d *schema.ResourceData,
997997
log.Printf("[DEBUG] No visibility update required. visibility: %s", d.Get("visibility"))
998998
}
999999

1000-
if d.HasChange("private") {
1000+
if d.HasChange("private") && !d.Get("archived").(bool) {
10011001
o, n := d.GetChange("private")
10021002
repoReq.Private = github.Ptr(n.(bool))
10031003
log.Printf("[DEBUG] Updating repository privacy from %v to %v", o, n)

0 commit comments

Comments
 (0)