Skip to content

ci: run CI only for trunk PRs and main pushes - #345

Merged
kjgbot merged 1 commit into
mainfrom
trunk
Oct 8, 2026
Merged

kjgbot merged 1 commit into
mainfrom
trunk

Conversation

@kjgbot

@kjgbot kjgbot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Org-wide CI reduction: CI runs only on the trunk → main PR and on pushes to main. Feature branches merge into trunk and get no CI. Adds trunk-guard.yml to flag PRs into main that don't come from trunk. Generated mechanically (job if: gates + push branch filters); actionlint shows no new findings.

🤖 Generated with Claude Code


Note

Medium Risk
Changes when and whether CI runs on PRs; misconfigured branch names could skip checks on unintended PRs or block legitimate merges until workflows are updated.

Overview
Narrows when CI runs so the main check job in ci.yml only executes on pushes to main and on pull requests whose head branch is trunk. Other PRs (e.g. feature branches targeting main) no longer trigger the full build/lint/test pipeline.

Adds a Trunk guard workflow that fails fast on any PR into main that does not come from trunk, with a workflow error telling contributors to retarget to trunk. This enforces the merge train model where feature work lands on trunk first and only trunk merges to main.

Reviewed by Cursor Bugbot for commit 17e94bd. Bugbot is set up for automated code reviews on this repo. Configure here.

Feature branches no longer run CI. Jobs triggered by pull_request(_target)
run only when the head branch is `trunk`; push triggers are limited to main
(release/env/tag pushes unchanged). trunk-guard.yml flags any PR into main
that does not come from `trunk`.
@kjgbot
kjgbot merged commit 1be0b3d into main Oct 8, 2026
@kjgbot
kjgbot deleted the trunk branch October 8, 2026 22:08
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 92346015-f4ef-4e3f-a825-b93ec2785edf
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review


jobs:
only-trunk-merges-to-main:
if: github.head_ref != 'trunk'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟨 Fork trunk branches bypass merge guard

A fork PR named trunk passes only-trunk-merges-to-main because github.head_ref omits the source repository. The guard cannot enforce that only the repository's trunk merges into main.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 17e94bd. Configure here.

# `trunk` (via the merge train); CI runs only on the trunk -> main PR.
on:
pull_request:
branches: [main]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Guard misses retargeted main PRs

Low Severity

The pull_request trigger uses default activity types, which omit edited. Retargeting a pull request onto main therefore does not start this workflow, so a non-trunk PR moved onto main is never flagged.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 17e94bd. Configure here.

kjgbot added a commit that referenced this pull request Oct 8, 2026
This reverts commit 1be0b3d, reversing
changes made to 5b0082a.
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