Skip to content

Add support for deploy key operations #4242

@0az

Description

@0az

Describe the feature or problem you’d like to solve

Add support for deploy key operations.

Proposed solution

This will enable command line deploy key operations without using the hub api (essentially curl) or curl.

Additional context

# GITHUB_REPO=octocat/spoon-knife

# Writes a SSH private/public key to `gh_deploy-buildbot-octocat-spoon-knife`(`.pub`) in the current working directory, with comment `deploy-key: buildbot@octocat/spoon-knife`
# Sets this as a deploy key in the octocat/spoon-knife repository, and prints out metadata
$ gh repo deploy-key create --read-write
name: buildbot
id	created at				title		type		public key
42	2021-08-25T14:48:56Z	buildbot	read-write	[SSH PUBLIC KEY HERE]
$

$ gh repo deploy-key list
# Lists deploy keys in a human-readable format
# Other options may include JSON output
id	created at				title		type		public key
42	2021-08-25T14:48:56Z	buildbot	read-write	[SSH PUBLIC KEY HERE]
$

# Deletes the given keys by `key_id`, by public key fingerprint, or by path to public key. Unless --dangerously-skip-confirmation is given, the command requires confirmation (retyping the `title` followed by a `y/N` prompt, exiting with nonzero status if an incorrect or empty `title` is given).
$ gh repo deploy-key delete 42
To confirm this action, retype the deploy key's title ("buildbot") below.
title: buildbot
Confirm deleting "buildbot" deploy key? [y/N] n
# Exits with nonzero status
$ gh repo deploy-key delete --dangerously-skip-confirmation ./gh_deploy-buildbot-octocat-spoon-knife
Successfully deleted deploy key "buildbot".

Tentatively interested in submitting a PR for this, time permitting. (Time generally does not permit, but I'm optimistic.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions