Skip to content

Commit 53aed08

Browse files
feat: add script to enable secret scanning on repositories script (#106)
* feat: add script to enable secret scanning on repositories with dry-run support * refactor: reduce code duplication * refactor: improve maintainability
1 parent eca147f commit 53aed08

File tree

2 files changed

+402
-0
lines changed

2 files changed

+402
-0
lines changed

gh-cli/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,29 @@ Using `curl`, `wget`, or `gh release download` to download public release assets
483483

484484
Enable actions on repository - similar to [API example](./../api/enable-actions-on-repository.sh), but using `gh cli`
485485

486+
### enable-secret-scanning-on-repositories.sh
487+
488+
Enables secret scanning on all repositories in an organization with support for both public and private repositories.
489+
490+
Usage:
491+
492+
```shell
493+
./enable-secret-scanning-on-repositories.sh joshjohanning-org
494+
./enable-secret-scanning-on-repositories.sh joshjohanning-org true
495+
```
496+
497+
The second parameter is optional for dry-run mode (true/false, defaults to false).
498+
499+
Features:
500+
501+
- Automatically handles Advanced Security enablement for private repositories when required
502+
- Dry-run mode to preview changes without making modifications
503+
- Comprehensive error handling and reporting
504+
- Skips repositories where secret scanning is already enabled
505+
506+
> [!NOTE]
507+
> This requires admin access to the repositories. For private repositories, the organization must have GitHub Advanced Security enabled.
508+
486509
### find-attachments-in-repositories.sh
487510

488511
Finds attachments in issues, pull requests, and optionally, issue/pull request comments. This finds both screenshots and file attachments.

0 commit comments

Comments
 (0)