Skip to main content

gh CLI reference

ModularPipelines.GitHub provides strongly typed access to the gh CLI.

Installation

dotnet add package ModularPipelines.GitHub

Import ModularPipelines.GitHub.Extensions, then resolve the service with context.Gh().

Module example

using ModularPipelines.Context;
using ModularPipelines.Models;
using ModularPipelines.Modules;
using ModularPipelines.GitHub.Extensions;
using ModularPipelines.GitHub.Options;

public class RunCommandModule : Module<CommandResult>
{
protected override async Task<CommandResult?> ExecuteAsync(
IModuleContext context,
CancellationToken cancellationToken)
{
return await context.Gh().Browse(
new GhBrowseOptions(),
cancellationToken: cancellationToken);
}
}

Commands

CLI commandOptions record
gh agent-task createGhAgentTaskCreateOptions
gh agent-task listGhAgentTaskListOptions
gh agent-task viewGhAgentTaskViewOptions
gh apiGhApiOptions
gh attestation downloadGhAttestationDownloadOptions
gh attestation trusted-rootGhAttestationTrustedRootOptions
gh attestation verifyGhAttestationVerifyOptions
gh auth loginGhAuthLoginOptions
gh auth logoutGhAuthLogoutOptions
gh auth refreshGhAuthRefreshOptions
gh auth setup-gitGhAuthSetupGitOptions
gh auth statusGhAuthStatusOptions
gh auth switchGhAuthSwitchOptions
gh auth tokenGhAuthTokenOptions
gh browseGhBrowseOptions
gh cache deleteGhCacheDeleteOptions
gh cache listGhCacheListOptions
gh codespace codeGhCodespaceCodeOptions
gh codespace cpGhCodespaceCpOptions
gh codespace createGhCodespaceCreateOptions
gh codespace deleteGhCodespaceDeleteOptions
gh codespace editGhCodespaceEditOptions
gh codespace jupyterGhCodespaceJupyterOptions
gh codespace listGhCodespaceListOptions
gh codespace logsGhCodespaceLogsOptions
gh codespace portsGhCodespacePortsOptions
gh codespace ports forwardGhCodespacePortsForwardOptions
gh codespace ports visibilityGhCodespacePortsVisibilityOptions
gh codespace rebuildGhCodespaceRebuildOptions
gh codespace sshGhCodespaceSshOptions
gh codespace stopGhCodespaceStopOptions
gh codespace viewGhCodespaceViewOptions
gh config clear-cacheGhConfigClearCacheOptions
gh config getGhConfigGetOptions
gh config listGhConfigListOptions
gh config setGhConfigSetOptions
gh copilotGhCopilotOptions
gh discussionGhDiscussionOptions
gh extension browseGhExtensionBrowseOptions
gh extension createGhExtensionCreateOptions
gh extension installGhExtensionInstallOptions
gh extension listGhExtensionListOptions
gh extension removeGhExtensionRemoveOptions
gh extension searchGhExtensionSearchOptions
gh extension upgradeGhExtensionUpgradeOptions
gh gist cloneGhGistCloneOptions
gh gist createGhGistCreateOptions
gh gist deleteGhGistDeleteOptions
gh gist editGhGistEditOptions
gh gist listGhGistListOptions
gh gist renameGhGistRenameOptions
gh gist viewGhGistViewOptions
gh gpg-key addGhGpgKeyAddOptions
gh gpg-key deleteGhGpgKeyDeleteOptions
gh gpg-key listGhGpgKeyListOptions
gh issueGhIssueOptions
gh label cloneGhLabelCloneOptions
gh label createGhLabelCreateOptions
gh label deleteGhLabelDeleteOptions
gh label editGhLabelEditOptions
gh label listGhLabelListOptions
gh licensesGhLicensesOptions
gh orgGhOrgOptions
gh prGhPrOptions
gh preview prompterGhPreviewPrompterOptions
gh project closeGhProjectCloseOptions
gh project copyGhProjectCopyOptions
gh project createGhProjectCreateOptions
gh project deleteGhProjectDeleteOptions
gh project editGhProjectEditOptions
gh project field-createGhProjectFieldCreateOptions
gh project field-deleteGhProjectFieldDeleteOptions
gh project field-listGhProjectFieldListOptions
gh project item-addGhProjectItemAddOptions
gh project item-archiveGhProjectItemArchiveOptions
gh project item-createGhProjectItemCreateOptions
gh project item-deleteGhProjectItemDeleteOptions
gh project item-editGhProjectItemEditOptions
gh project item-listGhProjectItemListOptions
gh project linkGhProjectLinkOptions
gh project listGhProjectListOptions
gh project mark-templateGhProjectMarkTemplateOptions
gh project unlinkGhProjectUnlinkOptions
gh project viewGhProjectViewOptions
gh releaseGhReleaseOptions
gh repoGhRepoOptions
gh ruleset checkGhRulesetCheckOptions
gh ruleset listGhRulesetListOptions
gh ruleset viewGhRulesetViewOptions
gh run cancelGhRunCancelOptions
gh run deleteGhRunDeleteOptions
gh run downloadGhRunDownloadOptions
gh run listGhRunListOptions
gh run rerunGhRunRerunOptions
gh run viewGhRunViewOptions
gh run watchGhRunWatchOptions
gh search codeGhSearchCodeOptions
gh search commitsGhSearchCommitsOptions
gh search issuesGhSearchIssuesOptions
gh search prsGhSearchPrsOptions
gh search reposGhSearchReposOptions
gh secret deleteGhSecretDeleteOptions
gh secret listGhSecretListOptions
gh secret setGhSecretSetOptions
gh skill installGhSkillInstallOptions
gh skill listGhSkillListOptions
gh skill previewGhSkillPreviewOptions
gh skill publishGhSkillPublishOptions
gh skill searchGhSkillSearchOptions
gh skill updateGhSkillUpdateOptions
gh ssh-key addGhSshKeyAddOptions
gh ssh-key deleteGhSshKeyDeleteOptions
gh ssh-key listGhSshKeyListOptions
gh statusGhStatusOptions
gh variable deleteGhVariableDeleteOptions
gh variable getGhVariableGetOptions
gh variable listGhVariableListOptions
gh variable setGhVariableSetOptions
gh workflow disableGhWorkflowDisableOptions
gh workflow enableGhWorkflowEnableOptions
gh workflow listGhWorkflowListOptions
gh workflow runGhWorkflowRunOptions
gh workflow viewGhWorkflowViewOptions