Skip to content

Magic type conversion for API POST not clearly documented #4365

@signalwerk

Description

@signalwerk

In gh api --help I can read

The --field flag behaves like ...
if the value starts with "@", the rest of the value is interpreted as a
filename to read the value from. Pass "-" to read from standard input.

Therefore, I would assume something like -f key="@./ci/.ssh/id_rsa.pub" would read my key. But either way I don't understand the documentation or it's a bug.

⚠️ NOT WORKING

gh api /repos/{owner}/{repo}/keys -f title='Drone CI' -f key="@./ci/.ssh/id_rsa.pub" -f read_only=false

Working but not using the magic type conversion

sshpub=`cat ./ci/.ssh/id_rsa.pub` && gh api /repos/{owner}/{repo}/keys -f title='Drone CI' -f key="$sshpub" -f read_only=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions