-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Describe the bug
When using gh secret list -o <org> --json 'name,numSelectedRepos' and sending the output to a file or to another process, the integers from numSelectedRepos are set to 0. However if the standard output is the interactive terminal, then the values are correct
gh version: 2.43.1, happens all the way back to 2.36.0 when --json option appeared.
I have only seen this behavior with gh secret list, I could not reproduce it with gh issue -R zephyrproject-rtos/zephyr list --json 'number' | cat - for instance.
Steps to reproduce the behavior
- Create a github organisation
dummyOrg - Create at least one repository inside
dummyOrg - Create a secret at the organisation level and share that secret with the repository created in previous step
- List secret at organisation level with json formatting:
gh secret list -o dummyOrg --json 'name,numSelectedRepos' | cat - - the
numSelectedReposfield is set to zero instead of 1.
Expected vs actual behavior
I am expecting the numSelectedRepos field to have a consistent value when piping the output of gh secret list command or sending it to the terminal
Logs
Sending output to terminal (expected behavior)
gh secret list -o dummyOrg --json 'name,numSelectedRepos'
[
{
"name": "MYSECRET",
"numSelectedRepos": 1
}
]Sending output to another process (unexpected behavior)
gh secret list -o dummyOrg --json 'name,numSelectedRepos' | cat -
[{"name":"MYSECRET","numSelectedRepos":0}]The numSelectedRepos has been converted to 0, the same unexpected behavior occurs with jq instead of cat - or sending the output to a file ( > file)