GitHub's AI Scan can now sweep a whole repository, but only when someone clicks the button
The pull request version never touched code already on the default branch. The new repository scan does, in public preview, with a manual trigger, a 20-repo bulk start and a REST switch. Five minutes to try on one repo.

Since its October launch, AI Scan has had one glaring gap: it only looked at pull requests, so every Dockerfile, Terraform module and shell script already on your default branch stayed unread until someone edited it. That gap is now closed, in part. AI Scan for repositories scans the default branch, in public preview, and drops its findings into the same code scanning backlog as CodeQL.
The earlier piece on the pull request version ended on the point that nothing gave you a baseline. This is the baseline. It comes with conditions, and most of them decide whether it’s worth switching on.
What changed
According to the GitHub changelog, the scan checks the default branch for vulnerabilities. It “covers languages CodeQL doesn’t support and finds additional issues in languages CodeQL already analyzes.” The docs go further: it supports all languages and runs independently of CodeQL.
Findings land in the code scanning alert list next to CodeQL alerts. You can filter by the AI Scan tool, assign alerts, link them to issues, add them to security campaigns or send them to agentic autofix. No Copilot licence is required.
Public repositories owned by an organisation are covered, as are public repositories on personal accounts. Private or internal organisation repositories need GitHub Code Security or GitHub Advanced Security. Private personal repositories aren’t supported, and neither is GitHub Enterprise Server.
How it works, and why that matters
This isn’t a pass over every file. According to the documentation, the agent searches for files and functions worth examining instead of reading everything, and it stops when its time budget runs out. The docs say outright that the scan isn’t exhaustive and doesn’t guarantee it finds every vulnerability.
Read that as a sampling strategy. A clean result on a large monorepo tells you the agent found nothing in the places it chose to look. It doesn’t tell you the repository is clean, and nothing in the alert list shows which files were skipped.
It also reads your existing CodeQL alerts and uses them to suppress matching findings. The docs call that matching best effort, so expect duplicates: the same flaw reported once by CodeQL and once by AI Scan, with slightly different wording.
The conditions
Four limits shape how you’d use it.
Manual only. Users with write access start a scan on demand. There are no scheduled scans and no scan on push, so a repository gets scanned exactly as often as someone remembers to do it. If you want a weekly sweep, that’s a gap to plan around: the changelog describes starting scans from the alerts pages, and the REST API it announces manages the setting, not the scans.
Default branch only. Feature branches and release branches aren’t scanned, which matters if your supported versions live on branches other than the default.
No rescan after a fix. Merging a fix doesn’t trigger another scan. According to the docs, an alert closes automatically only if the fix changes the exact line that triggered it. Fix the same flaw by changing a neighbouring line, or by moving the code, and the alert stays open until someone closes it by hand. Budget some triage time for that.
Self-hosted runners aren’t supported. If your code scanning runs on your own runners, plan around that.
A practical consequence for teams that ship from several repositories: the 20-repository bulk limit means a large organisation can’t sweep everything in one go. Rank repositories by how much infrastructure and shell code they hold and start with the top 20, since those are the ones where CodeQL has the least to say.
Cost, the part that fails quietly
Each scan consumes Code Security AI credits, billed separately from active-committer licensing. Included credits from a Copilot entitlement are used first.
The failure mode is the same one the pull request version has. According to the docs, if a hard budget leaves no credits, the feature can’t produce findings until the budget is raised or a new billing cycle starts. A scan that can’t run and a scan that ran and found nothing look alike on a quick glance. Before you trust an empty backlog, check the budget.
Switching it on, and where it won’t switch on
Enabling the setting doesn’t start any scan. Organisation owners and security managers turn it on. Repositories then inherit the setting, and repository administrators can opt out but can’t opt in against the organisation. If the organisation has it off, its repositories can’t turn it on. If an enterprise policy doesn’t allow it, the request fails. The enterprise default is “Not allowed”, and allowing it at enterprise level doesn’t enable it anywhere.
After enabling, a scan can be started from the organisation’s code scanning alerts page for up to 20 repositories at once (the bulk start is itself in public preview), or from a single repository’s alerts page.
The REST API from the 13 November changelog
manages the setting at both levels. The paths are GET and PATCH /orgs/{org}/code-scanning/ai-scan and GET and PATCH /repos/{owner}/{repo}/code-scanning/ai-scan, and the property is repository_scan, set to enabled or disabled. This is documented behaviour and hasn’t been run here, since it needs an organisation with Code Security:
# Read the current setting for one repository
gh api /repos/OWNER/REPO/code-scanning/ai-scan
# Turn repository scans on for it
gh api --method PATCH /repos/OWNER/REPO/code-scanning/ai-scan \
-f repository_scan=enabled
pr_scan and repository_scan can be changed in one request. If either change is blocked, the API returns 422 and neither setting changes, so check the response and re-read the setting afterwards instead of assuming the first one took.
What to do with it
Opinion: treat the first scan as a survey, not an audit. It’s a cheap way to find out whether the agent spots anything real in the files CodeQL never reads, and the answer is useful even when it’s no.
Pick one repository that has a lot of infrastructure code and no CodeQL coverage for it, such as one with a Dockerfile, a terraform folder and a scripts directory written mostly by agents. Start a scan from its alerts page, filter the alert list by the AI Scan tool, and read every finding. Count how many are real, how many duplicate a CodeQL alert and how many are wrong. Note the credit spend before you run it on twenty repositories at once.
If the real ones outnumber the noise, the next question is who owns the manual trigger. Put a recurring reminder on a named person, because nothing else will start the scan. Record the date of each run in the repository’s security notes too, so a later reader knows how stale the backlog is.