`gh secret list` should support search by secret name.
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### Describe the feature or problem you’d like to solve
`gh secret list` should support search by secret name. If I want to find all secrets beginning with `CODECOV`, I have to currently iterate through results of `gh secret list`.
### Proposed solution
It would be more efficient if I could just specify search text for secret name as part of `gh secret list` invocation and return the value(s) I am interested in. I believe the REST API for repository secrets does not currently support filtering by secret name but still think this should be handled by CLI.
Either it could be added as an arg: `gh secret list [glob] [flags]` or as a flag: `-S, --search`.
### Additional context
This issue came up at the same time as #12345.
I wanted to list all repos containing secrets whose names start with `ACTION` as I needed to update them due to expiring PATs.
Current:
```powershell
gci -Directory D:\git\ | % { pushd $_.FullName; $repo = (gh repo set-default -v *>&1); $secrets = if($repo -is [string]){gh secret list -R $repo} else {gh secret list}; if ($secrets -and ($secret = $secrets.Where({$_.Contains('ACTION')}))){ Write-Host -ForegroundColor Green $_.FullName; $secret}; popd }
```
Proposed[^1]:
```powershell
gci -Directory D:\git\ | % { pushd $_.FullName; $secrets = gh secret list 'ACTION*' ; if ($secrets){ Write-Host -ForegroundColor Green $_.FullName; $secret}; popd }
```
[^1]: Assumes this issue and #12345 are fixed.
Contributor guide
Assessment
This issue has not been assessed yet.