Skip to content

ci(repo-settings): use squash-merge only for clean release-please changelogs - #22

Open
cbrgm wants to merge 1 commit into
mainfrom
ci/repo-settings-squash-only
Open

ci(repo-settings): use squash-merge only for clean release-please changelogs#22
cbrgm wants to merge 1 commit into
mainfrom
ci/repo-settings-squash-only

Conversation

@cbrgm

@cbrgm cbrgm commented Jul 30, 2026

Copy link
Copy Markdown

What

Switches the repo-settings target from merge-commit to squash-merge only, and sets the squash commit message to the PR title/body.

  • allow_merge_commit: true -> false
  • allow_squash_merge: false -> true
  • adds squash_merge_commit_title=PR_TITLE + squash_merge_commit_message=PR_BODY

Why

With merge commits, a PR's feature-branch commits land on main next to the merge commit, and both carry Conventional-Commit messages. release-please walks the whole history and lists both, so every change shows up twice in the changelog. Squash-merge gives exactly one Conventional commit per PR on main = one changelog entry. The PR_TITLE/PR_BODY squash message keeps the squash subject as the Conventional commit and avoids release-please re-parsing the per-commit list that the default COMMIT_MESSAGES body would include.

This surfaced on solution-arsenal's first release-please changelog (0.3.0), which was full of duplicates.

Notes

Consumers pick this up on their next .common.mk-version bump, so this needs a new dev-kit tag to roll out. allow_rebase_merge, delete_branch_on_merge, allow_auto_merge are unchanged.

Summary by CodeRabbit

  • Configuration
    • Updated the repository’s merge strategy to disable merge commits and enable squash merges.
    • Squash merge titles and messages now use the pull request title and description.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The repo-settings recipe now disables merge commits, enables squash merges, keeps rebase merges disabled, and derives squash commit titles and messages from PR_TITLE and PR_BODY.

Changes

Merge strategy configuration

Layer / File(s) Summary
Squash merge settings
common.mk
The GitHub repository PATCH configuration disables merge commits, enables squash merges, retains disabled rebase merges, and sets squash commit metadata from PR_TITLE and PR_BODY.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: trevex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the repo-settings change to squash-merge only for release-please changelogs.
Description check ✅ Passed The description covers What, Why, and Notes well, though it omits Testing and the checklist from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/repo-settings-squash-only

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@common.mk`:
- Around line 114-118: Update the repository settings arguments in the make
target around allow_merge_commit, allow_squash_merge, and allow_rebase_merge to
use gh’s typed-field option instead of the raw-field option, ensuring true/false
values are serialized as JSON booleans while leaving string-valued fields
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c4f43c6-a7c1-4cf3-8851-3d314659924b

📥 Commits

Reviewing files that changed from the base of the PR and between d7e7744 and ecbe4d7.

📒 Files selected for processing (1)
  • common.mk

Comment thread common.mk
Comment on lines +114 to +118
-f allow_merge_commit=false \
-f allow_squash_merge=true \
-f allow_rebase_merge=false \
-f squash_merge_commit_title=PR_TITLE \
-f squash_merge_commit_message=PR_BODY \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

rg -n '^\s+-f (allow_merge_commit|allow_squash_merge|allow_rebase_merge|delete_branch_on_merge|allow_auto_merge)=' common.mk

Repository: opendefensecloud/dev-kit

Length of output: 354


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== common.mk context =="
sed -n '104,122p' common.mk | cat -n

echo
echo "== search for related boolean repo patches =="
rg -n 'gh api .*PATCH .*repos|allow_merge_commit|allow_squash_merge|allow_rebase_merge|delete_branch_on_merge|allow_auto_merge' -S .

echo
echo "== gh availability/version =="
if command -v gh >/dev/null 2>&1; then
  gh version
  gh api --help | sed -n '/--raw-field\|--typed-field/p'
else
  echo "gh command not available"
fi

echo
echo "== repository settings schemas in GitHub docs? local docs? =="
rg -n 'PATCH /repos/{owner}/{repo}|allow_merge_commit|delete_branch_on_merge|type.*true|type.*false' -S . || true

Repository: opendefensecloud/dev-kit

Length of output: 1832


🌐 Web query:

GitHub CLI gh api -f vs -F raw-field typed-field boolean fields

💡 Result:

In the GitHub CLI (gh), the --field (-F) and --raw-field (-f) flags behave differently regarding how they handle data types like booleans and numbers [1][2]. --field (-F) (Typed Field): This flag supports magic type conversion based on the value provided [1]. When you use -F, the GitHub CLI attempts to interpret specific literal values as their corresponding JSON types [1]. - Booleans: Values like true and false are automatically converted to JSON boolean types [1]. - Numbers: Integer numbers are converted to JSON number types [1]. - Null: The value null is converted to a JSON null type [1]. --raw-field (-f) (Raw Field): This flag treats all values as static strings [1][2]. It does not perform any automatic type conversion or JSON parsing on the value [2]. If you need a value to be treated strictly as a string—even if it looks like a boolean or number—you should use --raw-field [2]. Summary of Key Differences: - Use --field (-F) when you want the CLI to automatically handle JSON type conversion for booleans, numbers, and null values [1]. - Use --raw-field (-f) when you want to ensure the value is sent as a string [2]. - For complex data structures such as nested objects or arrays, neither flag is typically sufficient on its own [3][4]. In such cases, the recommended practice is to prepare the full JSON payload externally and pass it to the command using --input - (reading from standard input) or a file [1][3][4]. Example Usage: # Using -F for automatic type conversion (sends JSON boolean) gh api -X PATCH /repos/{owner}/{repo} -F archived=true # Using -f for string-only (sends "true" as a string, if the API expects a string) gh api -X PATCH /repos/{owner}/{repo} -f archived="true"

Citations:


🌐 Web query:

GitHub REST API update repository PATCH body allows auto merge allow squash merge merge commit true false boolean

💡 Result:

The GitHub REST API update repository endpoint (PATCH /repos/{owner}/{repo}) supports the following boolean parameters to control merge settings, which must be passed in the request body [1]: - allow_squash_merge (boolean): Set to true to allow squash-merging pull requests, or false to prevent it. The default value is true [1]. - allow_merge_commit (boolean): Set to true to allow merging pull requests with a merge commit, or false to prevent it. The default value is true [1]. - allow_auto_merge (boolean): Set to true to allow auto-merge on pull requests, or false to disallow it. The default value is false [1]. These parameters allow you to programmatically toggle repository merge configurations by sending the desired boolean value in your JSON request body [1].

Citations:


🌐 Web query:

GitHub REST API update repository PATCH allow_rebase_merge boolean merge commit

💡 Result:

To update repository settings using the GitHub REST API, you can use the PATCH /repos/{owner}/{repo} endpoint [1][2]. The allow_rebase_merge parameter is a boolean value that controls whether rebase-merging of pull requests is enabled for the repository [1][3]. Setting this to true allows rebase-merging, while false prevents it [1][4]. The default value for this setting is true [1][3]. When updating repository merge settings, you can also configure related options using the same PATCH endpoint, such as: allow_merge_commit (boolean): Enables or disables merging pull requests with a merge commit (default: true) [3][2]. allow_squash_merge (boolean): Enables or disables squash-merging of pull requests (default: true) [2][5]. For example, a JSON request body to update these settings would look like this: { "allow_merge_commit": true, "allow_squash_merge": true, "allow_rebase_merge": false } Note that managing repository merge settings requires the contents:read and contents:write permissions [2][5]. While this PATCH endpoint manages overall repository settings, actual pull request merges are performed using the PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge endpoint, which accepts a merge_method parameter (merge, squash, or rebase) [6].

Citations:


Use typed fields for boolean repository settings.

gh api -f/--raw-field sends literal string values, but the repository PATCH fields here are defined as booleans. Use -F/--typed-field so false/true are serialized as JSON booleans; otherwise the settings update can fail validation.

Proposed fix
-		-f allow_merge_commit=false \
-		-f allow_squash_merge=true \
-		-f allow_rebase_merge=false \
+		-F allow_merge_commit=false \
+		-F allow_squash_merge=true \
+		-F allow_rebase_merge=false \
 		-f squash_merge_commit_title=PR_TITLE \
 		-f squash_merge_commit_message=PR_BODY \
-		-f delete_branch_on_merge=true \
-		-f allow_auto_merge=true > /dev/null; \
+		-F delete_branch_on_merge=true \
+		-F allow_auto_merge=true > /dev/null; \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
-f allow_merge_commit=false \
-f allow_squash_merge=true \
-f allow_rebase_merge=false \
-f squash_merge_commit_title=PR_TITLE \
-f squash_merge_commit_message=PR_BODY \
-F allow_merge_commit=false \
-F allow_squash_merge=true \
-F allow_rebase_merge=false \
-f squash_merge_commit_title=PR_TITLE \
-f squash_merge_commit_message=PR_BODY \
-F delete_branch_on_merge=true \
-F allow_auto_merge=true > /dev/null; \
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@common.mk` around lines 114 - 118, Update the repository settings arguments
in the make target around allow_merge_commit, allow_squash_merge, and
allow_rebase_merge to use gh’s typed-field option instead of the raw-field
option, ensuring true/false values are serialized as JSON booleans while leaving
string-valued fields unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants