Skip to content

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

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
Org-wide change to when automated tests and lint run; feature branches no longer get CI on PRs, so quality depends on the trunk merge train and correct branch targeting.

Overview
Restricts GitHub Actions so lint, typecheck, test, build, and the CI Success aggregator run only on pushes to main and on pull requests whose head branch is trunk (not on feature-branch PRs into main).

The compact-on-merge job gets the same head-branch gate so trajectory compaction runs only when a trunk → main PR is merged.

Adds trunk-guard.yml, which fails any PR targeting main unless the source branch is trunk, steering feature work to merge into trunk first.

Reviewed by Cursor Bugbot for commit 6a3e425. 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 8df818e into main Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 51b6caf8-6acc-479b-aa4e-a6959013afed
📥 Commits

Reviewing files that changed from the base of the PR and between f682efb and 6a3e425.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/compact-on-merge.yml
  • .github/workflows/trunk-guard.yml
 ____________________________________________________________________________________________________________________________________________________________________________________________
< The object-oriented model makes it easy to build up programs by accretion. What this often means, in practice, is that it provides a structured way to write spaghetti code. - Paul Graham >
 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

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

Comment on lines +13 to +14
((github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || github.head_ref == 'trunk') &&
(github.event.pull_request.merged == true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Merged PR trajectories remain uncompacted

When a non-trunk PR merges into main, compact skips its trajectory compaction. Merged PRs outside trunk leave no compacted summary.

Learn more

This workflow runs when a PR targeting main closes. Its original merge condition compacted trajectories for every merged PR, independently of the CI workflow. The new head-branch condition skips merged PRs from other branches, so their summaries are never generated by this job. loadTrajectories only processes trajectories when the compact command runs.

Example: A hotfix PR from fix/crash merges into main. The close event reports merged: true, but the branch gate skips compact, leaving the hotfix trajectories without a summary.

Recommended fix: Restore the merged-only job condition. If compaction is also required for feature PRs merged into trunk, add a separate trunk close trigger and handle that target explicitly.

Suggested change
((github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || github.head_ref == 'trunk') &&
(github.event.pull_request.merged == true)
if: github.event.pull_request.merged == true

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 high effort and found 2 potential issues.

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 6a3e425. Configure here.

Comment thread .github/workflows/ci.yml
if: always()
if: >-
((github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || github.head_ref == 'trunk') &&
(always())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Skipped CI success passes required checks

Medium Severity

The ci-success aggregator, used for branch protection, now skips on non-trunk PRs. GitHub treats a skipped required check as passing, so existing required checks no longer block mis-targeted PRs. trunk-guard fails under a new check name that current protection rules would not require.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6a3e425. 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.

Trunk guard ignores base branch edits

Low Severity

trunk-guard.yml uses default pull_request types, which omit edited. Changing a PR base to main does not start a new run, so a retargeted feature PR can point at main without the failing guard check.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6a3e425. Configure here.

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