Skip to Content
FeaturesAuto-Scan on Push

Auto-scan on push

When a provider tells CodeStax that someone pushed to a repository’s default branch, CodeStax can queue a Smart scan of that branch. Push scans are not available on the Free plan.

Provider support

ProviderPush-triggered scansHow the event arrives
GitHubYespush events delivered to https://codestax.co/api/webhooks/github
Bitbucket Cloud (repository webhook)Yesrepo:push events delivered to https://codestax.co/api/webhooks/bitbucket
Bitbucket Cloud (Connect app)NoThe app delivers pull-request events only
GitLab.comNoThe GitLab webhook route handles merge-request events only

To install the webhooks, see Provider webhooks. GitLab.com repositories are still covered by the background branch check, which does not need a webhook.

Turn auto-scan on or off

  1. Open Settings → Policies.
  2. Expand Scanning policies.
  3. Switch Auto-scan on push on or off, then save.

This is an organization-wide setting. Only organization admins and owners can change it. If you have never saved it, it is on.

To override it for one repository, use the policy API. The Repository overrides section in the dashboard does not show this field.

PUT /api/policies/repo/{repo_id} Content-Type: application/json { "auto_scan_on_push": false }

The request needs a signed-in admin or owner session; API keys are rejected. A repository override, when present, takes priority over the organization setting.

What happens to a push

CodeStax runs these checks in order. The first one that fails stops processing, and the reason is returned in the webhook response, which you can see in your provider’s delivery log.

CheckResponse when it fails
The provider signature is valid401
The delivery has not been processed beforeAlready processed
The push updated a branch (tag pushes are ignored)not a branch push
The repository is connected in CodeStaxrepo not tracked
The pushed branch is the repository’s default branch. For Bitbucket, the default branch must be one of the branches in the push.push to <branch>, not default branch
Your plan includes auto-scanauto_scan_not_on_plan
Auto-scan on push is enabled for the repositoryauto_scan_disabled
No scan of that branch is already runningscan already in progress
GitHub only: no scan of that branch started within the cooldown (60 seconds by default)scan cooldown
Your organization has scans left this monthplan_limit_reached

If every check passes, CodeStax creates a Smart scan of the default branch and queues it. The scan applies the repository’s .codestax.yml exclusions (Repository configuration) but not scan profiles. A skipped push does not use any scan quota.

If the scanner cannot confirm the dispatch, CodeStax returns an error asking the provider to retry. A redelivery of the same push reuses the scan it already created, so it is not charged twice.

Background branch check

Every 15 minutes, CodeStax compares the latest commit on each tracked branch with the commit from that branch’s last completed scan. This catches pushes whose webhook was never delivered. The check covers GitHub, GitLab.com, and Bitbucket Cloud repositories that have a connected account token.

  • Branches checked: the default branch, plus the target branches of PR reviews from the last 7 days. A branch is checked only if it has been scanned before.
  • When it scans: the remote head has moved, and there is no scan of that commit and no scan of that branch in the last 30 minutes.
  • Limits: it queues a Smart scan only while your monthly scan quota has room.

A separate job queues a scan, at most once a day, for any pull-request target branch that has no recent completed scan. This keeps the merge check from reporting stale results.

In the current release, the background branch check and the pull-request target job do not read the Auto-scan on push setting or the plan’s auto-scan rule. Turning auto-scan off stops push-triggered scans, but these background scans can still run while you have scan quota left.

Confirm that deliveries arrive

On Integrations, each connected source-control card has a webhook row. It shows when a delivery last matched one of your repositories, or none received. After a push to the default branch, the new scan appears under Scans.

Scan feature branches

Push scans only cover the default branch. For feature branches, use pull-request reviews: see Set up PR reviews. To scan other branches on a timetable, use Scheduled scans.

Stop push scans but keep reviews

Turn off Auto-scan on push and keep the provider webhook installed. Pull-request events still trigger reviews. You can also remove only the push event from the webhook’s event list in your provider.