Skip to content

feat(merge): add Forgejo pull request merge support - #14

Open
RyzeNGrind wants to merge 1 commit into
mainfrom
fm/forgejo-merge-support
Open

RyzeNGrind wants to merge 1 commit into
mainfrom
fm/forgejo-merge-support

Conversation

@RyzeNGrind

Copy link
Copy Markdown
Owner

Summary

  • Adds forgejo) case to fm-pr-merge.sh's provider merge block, unblocking autonomous merges for nixify, obsidian-vault, dasagency.ca, and all other Forgejo-hosted projects in the fleet
  • Introduces forgejo_verify_mergeable() — reads live PR state via Forgejo REST API, validates state/merged/mergeable/draft, caches credentials (FORGEJO_TOKEN_CACHED/OWNER/REPO)
  • Introduces forgejo_confirm_merged() — reads back merged=true after the forge call to confirm landing; returns 2 (actionable, poll stays armed) if unreadable
  • The forgejo) merge case follows the same authority gate sequence as github/gitlab: verify → lock away record → re-check authority → POST squash merge → persist authority → confirm landed

Motivation

fm-pr-merge.sh only handled github and gitlab providers. The forgejo provider hit the *) fallback with "error: invalid PR merge request" (exit 2), blocking autonomous merges under the night-order gate-enable grant. As of 2026-09-28, nixify PRs kunchenguid#40, kunchenguid#41, and kunchenguid#62 are all green + mergeable but stuck awaiting this fix.

Credentials are read from $FM_FORGEJO_CREDS_FILE (defaults to ~/.config/das/forgejo.env), the same source fm-pr-lib.sh's existing Forgejo poll already uses.

Test plan

  • bash -n bin/fm-pr-merge.sh — syntax clean (verified)
  • Run against nixify PR#40 https://git.beta.nixify.dev/ryzengrind/nixify/pulls/40 (all-green, mergeable=true) after captain approves
  • Confirm merged=true read-back on confirmation
  • Verify authority record written to state/<id>.merge-authority

Adds a forgejo) case to the provider merge block in fm-pr-merge.sh,
unblocking autonomous merges for nixify, obsidian-vault, dasagency.ca,
and other Forgejo-hosted projects.

Introduces:
- forgejo_verify_mergeable(): reads live PR state via Forgejo API,
  sets FM_PR_MERGE_HEAD to the verified head sha, and caches credentials
  in FORGEJO_TOKEN/OWNER/REPO_CACHED for reuse within the merge sequence
- forgejo_confirm_merged(): reads back the merged= field after the forge
  call to confirm landing; returns 2 (actionable/poll-armed) if unreadable
- forgejo) merge case: verify → lock away record → re-check authority →
  POST squash merge → persist authority → confirm landed

All existing authority gates (away-posture lock, captain-hold check,
spawn-gen guard, control lock) apply unchanged. Credentials are read from
$FM_FORGEJO_CREDS_FILE (defaults to ~/.config/das/forgejo.env).
Copilot AI lite review requested due to automatic review settings September 28, 2026 14:52

Copilot AI 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.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 12 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: cabfc1ca-f12b-456b-ad1b-b22437270e09

📥 Commits

Reviewing files that changed from the base of the PR and between 304e920 and 8b9e292.

📒 Files selected for processing (1)
  • bin/fm-pr-merge.sh

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.

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