Skip to content

fix(ci): restrict merge pipeline to default/protected branches#90

Merged
Teebor-Choka merged 1 commit intomainfrom
kauki/fix/ci/merge-branch-filter
Apr 14, 2026
Merged

fix(ci): restrict merge pipeline to default/protected branches#90
Teebor-Choka merged 1 commit intomainfrom
kauki/fix/ci/merge-branch-filter

Conversation

@Teebor-Choka
Copy link
Copy Markdown
Contributor

@Teebor-Choka Teebor-Choka commented Apr 14, 2026

Summary

  • Add branches filter to the merge workflow pull_request trigger to prevent it from running on PR-to-PR merges
  • The workflow was triggering on all closed+merged PRs, including merges into non-default branches, wasting CI resources

@Teebor-Choka Teebor-Choka self-assigned this Apr 14, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

Warning

Rate limit exceeded

@Teebor-Choka has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 58 minutes and 41 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 58 minutes and 41 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aff32592-1e4a-43d8-a0cf-4c3155de21a7

📥 Commits

Reviewing files that changed from the base of the PR and between d54abee and c79ed69.

📒 Files selected for processing (1)
  • .github/workflows/merge.yaml
📝 Walkthrough

Walkthrough

A GitHub Actions workflow trigger filter has been added to the merge workflow. The pull_request event trigger for closed events is now restricted to pull requests targeting the main branch via a new branches: [main] configuration.

Changes

Cohort / File(s) Summary
Workflow Trigger Configuration
.github/workflows/merge.yaml
Added branches: [main] filter to pull_request event trigger to restrict closed event handling to the main branch only.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a branch filter to restrict the merge CI pipeline to run only on the default/protected branches.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kauki/fix/ci/merge-branch-filter

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 and usage tips.

@Teebor-Choka Teebor-Choka force-pushed the kauki/fix/ci/merge-branch-filter branch 2 times, most recently from 5115786 to 34747f2 Compare April 14, 2026 12:47
@Teebor-Choka Teebor-Choka marked this pull request as ready for review April 14, 2026 12:50
Copilot AI review requested due to automatic review settings April 14, 2026 12:50
@Teebor-Choka Teebor-Choka enabled auto-merge (squash) April 14, 2026 12:51
@Teebor-Choka Teebor-Choka requested a review from a team April 14, 2026 12:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restricts the “Merge” GitHub Actions workflow so it only triggers for PRs closed against the main branch, reducing CI usage for non-default-branch merges.

Changes:

  • Added a pull_request.branches: [main] filter to the merge workflow trigger.
  • Keeps existing job-level merged == true gating, but reduces unnecessary workflow triggers on non-main base branches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +6 to +7
branches:
- main
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The PR description says a base.ref check was added to all job conditions, but this change only adds an on.pull_request.branches: [main] filter; the job if: clauses are unchanged. Either update the description to match the implementation, or add github.event.pull_request.base.ref checks to the jobs (e.g., comparing against github.event.repository.default_branch if the intent is truly “default branch”).

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
branches:
- main
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Hard-coding main here means the workflow will stop running if the repository’s default branch is renamed, and it doesn’t match the title’s “default/protected branches” wording. If you need this to follow the repo default branch, consider moving the branch restriction into job-level if: using github.event.repository.default_branch (or explicitly list all allowed base branches here if that’s the intent).

Copilot uses AI. Check for mistakes.
Add branches filter to the pull_request trigger so the merge
workflow only fires for PRs targeting the default branch.
Previously it triggered for all merged PRs, including
PR-to-PR merges.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Teebor-Choka Teebor-Choka force-pushed the kauki/fix/ci/merge-branch-filter branch from 34747f2 to c79ed69 Compare April 14, 2026 13:02
@Teebor-Choka Teebor-Choka disabled auto-merge April 14, 2026 18:45
@Teebor-Choka Teebor-Choka merged commit 6c219c6 into main Apr 14, 2026
19 of 22 checks passed
@Teebor-Choka Teebor-Choka deleted the kauki/fix/ci/merge-branch-filter branch April 14, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants