Skip to content

Commit 77d176a

Browse files
AbhishekBhaskarCopilotsophietheking
authored
Add exclude-paths option in dependabot config (#57214)
Co-authored-by: Copilot <[email protected]> Co-authored-by: Sophie <[email protected]>
1 parent bc78d24 commit 77d176a

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

content/code-security/dependabot/working-with-dependabot/dependabot-options-reference.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,66 @@ When `target-branch` is defined:
686686
* All pull requests for version updates are opened targeting the specified branch.
687687
* Options defined for this `package-ecosystem` no longer apply to security updates because security updates always use the default branch for the repository.
688688

689+
## `exclude-paths` {% octicon "versions" aria-label="Version updates only" height="24" %}
690+
691+
Use to specify paths of directories and files that {% data variables.product.prodname_dependabot %} should ignore when scanning for manifests and dependencies. This option is useful when you want to prevent updates for dependencies in certain locations, such as test assets, vendored code, or specific files.
692+
693+
{% data variables.product.prodname_dependabot %} default behavior:
694+
695+
* All directories and files in the specified `directory` are included in the update scan unless excluded by this option.
696+
697+
When `exclude-paths` is defined:
698+
699+
* All files and directories matching the specified paths are ignored during update scans for the given `package-ecosystem` entry.
700+
701+
| Parameter | Purpose |
702+
|-----------|---------|
703+
| `exclude-paths` | A list of glob patterns for files or directories to ignore. |
704+
705+
Glob patterns are supported, such as `**` for recursive matching and `*` for single-segment wildcards. Patterns are relative to the `directory` specified for the update configuration. Each ecosystem can have its own `exclude-paths` settings.
706+
707+
## Example
708+
709+
```yaml copy
710+
version: 2
711+
updates:
712+
- package-ecosystem: "npm"
713+
directory: "/"
714+
schedule:
715+
interval: "daily"
716+
exclude-paths:
717+
- "src/test/assets"
718+
- "vendor/**"
719+
- "src/*.js"
720+
- "src/test/helper.js"
721+
722+
# Sample patterns that can be used-
723+
724+
# Pattern: docs/*.json
725+
# Matches: docs/foo.json, docs/bar.json
726+
727+
# Pattern: *.lock
728+
# Matches: Gemfile.lock, package.lock, foo.lock (in any directory)
729+
730+
# Pattern: test/**
731+
# Matches: test/foo.rb, test/bar/baz.rb, test/any/depth/file.txt
732+
733+
# Pattern: config/settings.yml
734+
# Matches: config/settings.yml
735+
736+
# Pattern: **/*.md
737+
# Matches: README.md, docs/guide.md, any/depth/file.md
738+
739+
# Pattern: src/*
740+
# Matches: src/main.rb, src/app.js
741+
# Does NOT match: src/utils/helper.rb
742+
743+
# Pattern: hidden/.*
744+
# Matches: hidden/.env, hidden/.secret
745+
```
746+
747+
In this example, {% data variables.product.prodname_dependabot %} will ignore the `src/test/assets` directory, all files under `vendor/`, all JavaScript files directly under `src/`, and the specific file `src/test/helper.js` when scanning for updates.
748+
689749
## `vendor` {% octicon "versions" aria-label="Version updates" height="24" %} {% octicon "shield-check" aria-label="Security updates" height="24" %}
690750

691751
Supported by: `bundler` and `gomod` only.

0 commit comments

Comments
 (0)