You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: github_repository doesn't read merge settings for archived repositories, causing a permanent diff #3758
An archived github_repository whose config matches its real settings plans with no changes.
Actual Behavior
Every plan shows an in-place update adding allow_auto_merge, allow_merge_commit, allow_rebase_merge, allow_squash_merge, allow_update_branch, delete_branch_on_merge, merge_commit_message, merge_commit_title, squash_merge_commit_message, squash_merge_commit_title and web_commit_signoff_required. Apply skips updates to archived repositories, so the diff never settles.
The cause is in resourceGithubRepositoryRead, which only sets these fields when the repository isn't archived:
// TODO: Validate this behavior as I can see these fields being returned even when archived// GitHub API doesn't respond following parameters when repository is archivedif!d.Get("archived").(bool) {
The REST API does return them for archived repositories: GET /repos/{owner}/{repo} includes allow_merge_commit, merge_commit_title and the rest. Removing the condition fixes the diff and still detects real drift: with it removed, changing allow_merge_commit in config shows true -> false.
Terraform Version
OpenTofu v1.12.1, provider v6.12.1. The same code is on main.
GitHub Installation Type
GitHub Enterprise Cloud with Personal Accounts (github.com)
I have a fix for this on my fork, ready to open as a PR if you'd like one: gaima8@fc34bcc
It removes the if !archived condition in resourceGithubRepositoryRead, so the merge settings are always read, and adds an acceptance test (reads_merge_settings_of_archived_repositories) that archives a repository with non-default merge settings and then imports it with ImportStateVerify.
Tested against a GitHub Enterprise Cloud org: archived repositories plan with no changes, and a real difference in config (e.g. allow_merge_commit) still shows as drift.
Correction to the issue: the diff isn't permanent. Applying once stores the configured values (the update itself is skipped, as the repository is archived), and later plans are clean.
The underlying problem remains: the provider never reads these settings for archived repositories, so state reflects config rather than GitHub, and the first plan after importing an archived repository always shows them being added. The fix above reads the real values.
Activity
github-actions commentedon Nov 26, 2026
👋 Hi, and thank you for opening this issue!
This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.
You can help us prioritize by adding details, reproduction steps, or a 👍 to issues that matter to you, and by joining the discussion on open issues.
🤖 This is an automated message.
gaima8 commentedon Nov 27, 2026
I have a fix for this on my fork, ready to open as a PR if you'd like one: gaima8@fc34bcc
It removes the
if !archivedcondition inresourceGithubRepositoryRead, so the merge settings are always read, and adds an acceptance test (reads_merge_settings_of_archived_repositories) that archives a repository with non-default merge settings and then imports it withImportStateVerify.Tested against a GitHub Enterprise Cloud org: archived repositories plan with no changes, and a real difference in config (e.g.
allow_merge_commit) still shows as drift.gaima8 commentedon Nov 27, 2026
Correction to the issue: the diff isn't permanent. Applying once stores the configured values (the update itself is skipped, as the repository is archived), and later plans are clean.
The underlying problem remains: the provider never reads these settings for archived repositories, so state reflects config rather than GitHub, and the first plan after importing an archived repository always shows them being added. The fix above reads the real values.