fj pr merge 405s on squash-only repos (no way to select merge method) #201

Open
opened 2026-07-01 02:42:20 +00:00 by stephen · 0 comments
Owner

What happens

fj pr merge <n> fails with HTTP 405 Method Not Allowed on a repo that only allows squash merges, even when the PR is fully mergeable (mergeable: true, checks green, no required reviewers).

$ fj pr merge 884 --repo rasterstate/fjord-ios
error: HTTP status client error (405 Method Not Allowed) for url
  (https://rasterhub.com/api/v1/repos/rasterstate/fjord-ios/pulls/884/merge)

fj pr merge also exposes no flag to pick the merge method:

$ fj pr merge 884 --repo rasterstate/fjord-ios --squash
error: ... tip: to pass '--squash' as a value, use '-- --squash'
Usage: fj pr merge --repo <REPO> <NUMBER>

Root cause (hypothesis)

Forgejo's merge endpoint POST /repos/{owner}/{repo}/pulls/{n}/merge takes a Do field (merge / squash / rebase / rebase-merge). fj pr merge appears to hardcode Do: merge with no way to override. When the repo disables merge commits, Forgejo rejects the disallowed style with 405. The repo's actual allowed/default style is ignored.

Confirmed on the repo in question:

$ fj api repos/rasterstate/fjord-ios | jq '{allow_merge_commits, allow_squash_merge, default_merge_style}'
{ "allow_merge_commits": false, "allow_squash_merge": true, "default_merge_style": "squash" }

Workaround

Post the merge with the allowed style directly:

fj api --method POST repos/rasterstate/fjord-ios/pulls/884/merge --field Do=squash

This succeeds and the PR merges.

Suggestions

  1. Add a merge-method flag to fj pr merge (e.g. --squash / --merge / --rebase, or --method <style>).
  2. Default the Do value to the repo's default_merge_style (from GET /repos/{o}/{r}) instead of hardcoding merge; fall back to the first allowed style.
  3. Translate the raw 405 into an actionable message, e.g. "this repo does not allow the 'merge' style; try --squash".

Environment

  • fj 0.2.0
  • host: rasterhub.com
## What happens `fj pr merge <n>` fails with **HTTP 405 Method Not Allowed** on a repo that only allows squash merges, even when the PR is fully mergeable (`mergeable: true`, checks green, no required reviewers). ``` $ fj pr merge 884 --repo rasterstate/fjord-ios error: HTTP status client error (405 Method Not Allowed) for url (https://rasterhub.com/api/v1/repos/rasterstate/fjord-ios/pulls/884/merge) ``` `fj pr merge` also exposes no flag to pick the merge method: ``` $ fj pr merge 884 --repo rasterstate/fjord-ios --squash error: ... tip: to pass '--squash' as a value, use '-- --squash' Usage: fj pr merge --repo <REPO> <NUMBER> ``` ## Root cause (hypothesis) Forgejo's merge endpoint `POST /repos/{owner}/{repo}/pulls/{n}/merge` takes a `Do` field (`merge` / `squash` / `rebase` / `rebase-merge`). `fj pr merge` appears to hardcode `Do: merge` with no way to override. When the repo disables merge commits, Forgejo rejects the disallowed style with 405. The repo's actual allowed/default style is ignored. Confirmed on the repo in question: ``` $ fj api repos/rasterstate/fjord-ios | jq '{allow_merge_commits, allow_squash_merge, default_merge_style}' { "allow_merge_commits": false, "allow_squash_merge": true, "default_merge_style": "squash" } ``` ## Workaround Post the merge with the allowed style directly: ``` fj api --method POST repos/rasterstate/fjord-ios/pulls/884/merge --field Do=squash ``` This succeeds and the PR merges. ## Suggestions 1. Add a merge-method flag to `fj pr merge` (e.g. `--squash` / `--merge` / `--rebase`, or `--method <style>`). 2. Default the `Do` value to the repo's `default_merge_style` (from `GET /repos/{o}/{r}`) instead of hardcoding `merge`; fall back to the first allowed style. 3. Translate the raw 405 into an actionable message, e.g. "this repo does not allow the 'merge' style; try --squash". ## Environment - fj 0.2.0 - host: rasterhub.com
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rasterstate/fj#201
No description provided.