Skip to content

feat: add auto-merge for PRs passing CI and review score - #26

Merged
jonit-dev merged 1 commit into
mainfrom
night-watch/16-pr-auto-merge-after-ci-review-score-pass
Feb 20, 2026
Merged

feat: add auto-merge for PRs passing CI and review score#26
jonit-dev merged 1 commit into
mainfrom
night-watch/16-pr-auto-merge-after-ci-review-score-pass

Conversation

@jonit-dev

Copy link
Copy Markdown
Owner

Summary

Add autoMerge configuration option to automatically merge PRs that pass CI checks and meet the review score threshold. This enables a fully hands-off PRD-to-merge pipeline.

Features

  • autoMerge config field (default: false, off by default for safety)
  • autoMergeMethod config field (squash|merge|rebase, default: squash)
  • --auto-merge CLI flag to enable for a single run
  • NW_AUTO_MERGE and NW_AUTO_MERGE_METHOD env vars for override
  • Uses gh pr merge --auto --delete-branch to respect branch protection rules
  • pr_auto_merged notification event type for webhook integration
  • Auto-merge status shown in status command and review --dry-run

Configuration Example

{
  "autoMerge": true,
  "autoMergeMethod": "squash"
}

CLI Usage

# Enable auto-merge for a single run
night-watch review --auto-merge

# View auto-merge status
night-watch status
night-watch review --dry-run

Behavior

  • Auto-merge triggers when all open PRs have passing CI AND review score >= threshold
  • Uses --auto flag which queues the merge (respects branch protection rules)
  • Failures are logged but don't fail the reviewer run
  • Only targets PRs matching branchPatterns (same filter as reviewer)

Closes #16

Add autoMerge configuration option to automatically merge PRs that pass
CI checks and meet the review score threshold. This enables a fully
hands-off PRD-to-merge pipeline.

Features:
- autoMerge config field (default: false, off by default for safety)
- autoMergeMethod config field (squash|merge|rebase, default: squash)
- --auto-merge CLI flag to enable for a single run
- NW_AUTO_MERGE and NW_AUTO_MERGE_METHOD env vars for override
- Uses `gh pr merge --auto --delete-branch` to respect branch protection
- pr_auto_merged notification event type for webhook integration
- Auto-merge status shown in status command and review dry-run

Closes #16

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jonit-dev
jonit-dev force-pushed the night-watch/16-pr-auto-merge-after-ci-review-score-pass branch from df00625 to 68d2cea Compare February 20, 2026 05:10
@jonit-dev

Copy link
Copy Markdown
Owner Author

Night Watch PR Fix

Merge Conflicts Resolved:

Rebased onto main. Resolved conflicts in:

  • src/tests/commands/review.test.ts
  • src/tests/commands/status.test.ts
  • src/config.ts
  • src/constants.ts
  • src/types.ts
  • src/utils/notify.ts
  • templates/night-watch.config.json

Changes made:

  • Kept both the QA/Slack/fallback features from main and the auto-merge feature from this PR
  • Fixed duplicate declarations in constants.ts
  • Fixed extra closing braces in config.ts

yarn verify passes locally. Ready for re-review.


Night Watch PR Reviewer

@jonit-dev
jonit-dev merged commit 07daeed into main Feb 20, 2026
1 of 3 checks passed
@jonit-dev
jonit-dev deleted the night-watch/16-pr-auto-merge-after-ci-review-score-pass branch February 20, 2026 05:24
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.

PR Auto-Merge after CI + Review Score Pass

1 participant