Skip to content

Commit 6f934ec

Browse files
author
Kristián Leško
authored
Do not change allow_update_branch/has_downloads on archived repos (#1795)
Avoid causing a permanent `plan` diff by attempting to change attributes that can no longer be modified if a repository is archived. Fixes #1793.
1 parent 8ad3299 commit 6f934ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

github/resource_github_repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,6 @@ func resourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) erro
636636
d.Set("has_projects", repo.GetHasProjects())
637637
d.Set("has_wiki", repo.GetHasWiki())
638638
d.Set("is_template", repo.GetIsTemplate())
639-
d.Set("has_downloads", repo.GetHasDownloads())
640639
d.Set("full_name", repo.GetFullName())
641640
d.Set("default_branch", repo.GetDefaultBranch())
642641
d.Set("html_url", repo.GetHTMLURL())
@@ -648,15 +647,16 @@ func resourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) erro
648647
d.Set("topics", flattenStringList(repo.Topics))
649648
d.Set("node_id", repo.GetNodeID())
650649
d.Set("repo_id", repo.GetID())
651-
d.Set("allow_update_branch", repo.GetAllowUpdateBranch())
652650

653651
// GitHub API doesn't respond following parameters when repository is archived
654652
if !d.Get("archived").(bool) {
655653
d.Set("allow_auto_merge", repo.GetAllowAutoMerge())
656654
d.Set("allow_merge_commit", repo.GetAllowMergeCommit())
657655
d.Set("allow_rebase_merge", repo.GetAllowRebaseMerge())
658656
d.Set("allow_squash_merge", repo.GetAllowSquashMerge())
657+
d.Set("allow_update_branch", repo.GetAllowUpdateBranch())
659658
d.Set("delete_branch_on_merge", repo.GetDeleteBranchOnMerge())
659+
d.Set("has_downloads", repo.GetHasDownloads())
660660
d.Set("merge_commit_message", repo.GetMergeCommitMessage())
661661
d.Set("merge_commit_title", repo.GetMergeCommitTitle())
662662
d.Set("squash_merge_commit_message", repo.GetSquashMergeCommitMessage())

0 commit comments

Comments
 (0)