Skip to content

slash-commands: direct-merge fallback for code-owner review#16

Merged
localden merged 1 commit into
mainfrom
den/lgtm-codeowner-bypass
Mar 28, 2026
Merged

slash-commands: direct-merge fallback for code-owner review#16
localden merged 1 commit into
mainfrom
den/lgtm-codeowner-bypass

Conversation

@localden

Copy link
Copy Markdown
Contributor

Summary

When branch protection enables Require review from Code Owners, the
GitHub App's APPROVE review does not satisfy it — Apps cannot be members
of org teams, so they cannot be code owners via a team entry. Auto-merge
also does not inherit the App's ruleset-bypass privileges, so the PR
sits in BLOCKED/REVIEW_REQUIRED forever with auto-merge enabled but
never firing.

  • Read reviewDecision back from the enablePullRequestAutoMerge
    mutation. If still REVIEW_REQUIRED after we submitted an approval,
    attempt a direct merge — a direct merge does use the App's bypass.
  • Extract a shared mergeDirect helper for both this path and the
    existing clean-status fallback. Catches failures and emits an
    actionable warning pointing at the ruleset bypass-list setup.
  • README: document the bypass-list requirement under the Merge gate
    section with the exact Settings navigation path.

Test plan

  • Point a consuming repo's workflow at @den/lgtm-codeowner-bypass
  • /lgtm force on a PR where branch protection has
    require_code_owner_review and the App is in the ruleset bypass
    list → merges directly instead of stalling on auto-merge
  • /lgtm on a PR without code-owner requirement → auto-merge
    enabled, no behavior change

…e-owner check

When branch protection enables require_code_owner_review, the GitHub
App's APPROVE review does not satisfy it (Apps cannot be team members).
Auto-merge also does not inherit the App's ruleset-bypass privileges,
so the PR sits in BLOCKED/REVIEW_REQUIRED forever with auto-merge
enabled but never firing.

Detect this by reading reviewDecision back from the
enablePullRequestAutoMerge mutation. If it is still REVIEW_REQUIRED
after we submitted an approval, attempt a direct merge instead — a
direct merge does use the App's bypass.

Both direct-merge paths (this new one and the existing clean-status
fallback) now go through a shared mergeDirect helper that catches
failures and emits an actionable warning pointing at the ruleset
bypass-list setup.

:house: Remote-Dev: homespace
@localden localden merged commit 0540b7f into main Mar 28, 2026
1 check passed
@localden localden deleted the den/lgtm-codeowner-bypass branch March 28, 2026 01:32
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.

1 participant