Run CI on All Branch Pushes and Cancel Superseded Jobs: A Practical GitHub Actions Pattern | Cybernomics
toolsSaturday, July 4, 2026

Run CI on All Branch Pushes and Cancel Superseded Jobs: A Practical GitHub Actions Pattern

Changing CI to run on pushes to any branch and cancel superseded runs improves developer feedback and reduces wasted compute. Adding a per-ref concurrency group ensures rapid amend-push workflows don't queue redundant jobs, accelerating iteration and stabilizing pipelines.

Problem and change

Historically some CI configurations only ran on the default branch for push events, leaving same-repo branches untested until a PR was opened. The change to run CI on all branch pushes ensures contributors get immediate feedback and prevents regressions from being merged into feature branches. Pairing this with a per-ref concurrency group cancels outdated runs when a branch is rapidly amended and pushed.

Benefits for engineering teams

Immediate feedback loops shorten debug cycles and make it cheaper to catch integration issues early. Canceling superseded runs saves CI minutes and cost while lowering queue times for other jobs. This pattern particularly benefits active feature development where force-pushes or frequent commits are common.

Implementation considerations

On GitHub Actions, use push: { branches: [''] } and configure concurrency with a key like ${{ github.ref }} so only the latest run for a branch proceeds. Be mindful that branches with an open PR will trigger both push and pull_request events-evaluate whether both are necessary or if you should filter to avoid duplicate runs. For forks, pull_request remains the safe trigger to respect contributor permissions.

Operational advice

Monitor CI usage after enabling this pattern to quantify savings and ensure no key validations are skipped. Document the behavior for contributors and consider gating expensive jobs behind PR events while running fast linters/builds on every push. Finally, communicate the change so developers expect quicker cancellations of previous runs and can rely on more timely CI feedback.

CIGitHub Actionsdevopsworkflows

Original Source

MCP Servers (GitHub)

Read Original