You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fa701d5
Browse filesBrowse the repository at this point in the historyBrowse files
Check --branch and --commit-sha before marking a scan as the default branch
Default-branch detection read only the CI variables. On GitHub Actions it
compared GITHUB_REF to the repository's default branch and checked that the
GITHUB_SHA commit is on it; --branch and --commit-sha were never consulted.
A workflow_run job triggered by develop (the default branch) that checks
out a release tag on main and passes --branch main --commit-sha <tag> was
detected as a default-branch scan. The full scan was created with
make_default_branch=true and set_as_pending_head=true, which moved the
repository's default branch to main, and with develop's commit message.
Without --scm, DEFAULT_BRANCH=false did not help, and nothing could turn
--default-branch detection off.
When --branch or --commit-sha names a different ref than the CI variables,
the scan is no longer treated as the default branch unless that branch is
the default branch and that commit is on it. A commit missing from the
checkout cannot be checked, so it is not treated as the default branch
either. The check can only turn detection off; --default-branch still marks
a scan explicitly. The commit message and the committer fallback now come
from the --commit-sha commit when the checkout has it. Changed-file
detection still reads the CI variables.
Add --no-default-branch, which forces make_default_branch and
set_as_pending_head off whatever git or the CI environment says. It is
mutually exclusive with --default-branch, on the command line and in a
--config file.
Set the version to 2.16.0.
|`--default-branch`| False |*auto*| Make this branch the default branch (auto-detected from git and CI environment when not specified) |
327
+
|`--no-default-branch`| False | False | Never make this scan the default branch or its head scan, whatever git or the CI environment says. Mutually exclusive with `--default-branch`|
327
328
|`--include-module-folders`| False | False | Includes supported manifests found under `node_modules`, `bower_components`, and `jspm_packages`in manifest discovery. Equivalent to `--include-dirs node_modules,bower_components,jspm_packages`. Other discovery exclusions still apply. For an inventory of installed packages, see [Packages installed outside the lockfile](troubleshooting.md#packages-installed-outside-the-lockfile). |
328
329
329
330
#### Output Configuration
@@ -721,11 +722,13 @@ The CLI now automatically detects repository information from your git environme
721
722
722
723
The CLI uses intelligent default branch detection with the following priority:
723
724
724
-
1. **Explicit `--default-branch` flag**: Takes highest priority when specified
725
+
1. **Explicit `--no-default-branch` or `--default-branch` flag**: Takes highest priority when specified
725
726
2. **CI environment detection**: Uses CI platform variables (GitHub Actions, GitLab CI, and Bitbucket Pipelines)
726
727
3. **Git repository analysis**: Compares current branch with repository's default branch
727
728
4. **Fallback**: Defaults to `false`if none of the above methods succeed
728
729
730
+
When `--branch` or `--commit-sha` names a different ref than the CI variables, git repository analysis also checks the ref you passed: the scan is not treated as the default branch unless that branch is the default branch and that commit is on it. These flags never turn detection on; use `--default-branch`forthat. With `--commit-sha`, the commit message and committer come from that commit when it isin the checkout.
731
+
729
732
A scan on the default branch also becomes that branch's head scan. `--pending-head` is deprecated and has no effect: it is still accepted so existing pipelines keep working, but it logs a warning. Use `--default-branch` instead.
0 commit comments