Repository navigation
fix: Error at plan when merge/squash commit title/message set with strategy disabled (alt. to #3556) - #3558
fix: Error at plan when merge/squash commit title/message set with strategy disabled (alt. to #3556)#3558ecerulm wants to merge 2 commits into
Conversation
…rategy disabled GitHub rejects any change to merge_commit_title/message (and the squash_merge_commit_* equivalents) while the corresponding merge strategy is disabled, returning HTTP 422 "no_merge_strategy". A config that both disables a strategy and explicitly sets these values can therefore never be applied. Add a CustomizeDiff validation that fails the plan with a clear message when the user has explicitly configured these fields (detected via the raw config, so schema defaults do not trigger it) while allow_merge_commit / allow_squash_merge is false. This surfaces the mistake at plan time instead of producing a plan that silently never converges. Alternative approach to integrations#3554 (see also the diff-suppression + warning approach). Resolves integrations#3554
|
👋 Hi, and thank you for this contribution! 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 joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
|
Thanks for putting this PR together and taking the time to contribute! We're temporarily moving to an issue-first model (see CONTRIBUTING.md) where only collaborators can open PRs while we work through the backlog. Because of that, I'm going to close this PR for now. I've linked it on #3554 so we don't lose your work or context when we pick that issue up. Feel free to add a 👍 or any extra notes there to help us prioritize it. |
Resolves #3554
Background
merge_commit_title/merge_commit_message(and thesquash_merge_commit_*equivalents) cannot be set on GitHub while the corresponding merge strategy is disabled. Withallow_merge_commit = false, the REST API returns:The current provider avoids the 422 by simply not sending these fields when the strategy is off — but nothing tells the user, so the plan keeps showing a change that the apply silently never makes: perpetual, non-convergent drift.
After the change?
A
CustomizeDiffvalidation fails the plan when the user has explicitly configuredmerge_commit_*/squash_merge_commit_*while the correspondingallow_merge_commit/allow_squash_mergeisfalse:Key details:
GetRawConfig), i.e. the value is actually present in the user's.tf. Becausemerge_commit_*have schema defaults, a config that only setsallow_merge_commit = falseand never mentions the title/message is not affected.CustomizeDiff), so it's caught before any apply.Trade-off vs #3556
Verification
Verified against a real repository:
allow_merge_commit=false+merge_commit_titleexplicitly set → plan errors ✅allow_merge_commit=false, title/message not set → plan succeeds ✅ (no false positive)allow_merge_commit=true+ title set → plan succeeds ✅Pull request checklist
Does this introduce a breaking change?
merge_commit_*/squash_merge_commit_*while the corresponding strategy is disabled will now fail at plan time (previously it applied with perpetual drift).