Skip to main content
Version: Next

gh CLI reference

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

Executable prerequisite

This package does not install the gh executable. Install it separately and ensure gh is available on PATH.

Follow the executable's official documentation for installation instructions.

Package installation

dotnet add package ModularPipelines.GitHub

Resolve the service with context.Tools.Gh. Projects using C# 13 or another .NET language can use context.Tools.Get<ModularPipelines.GitHub.Services.IGh>() instead.

Module example

using ModularPipelines;
using ModularPipelines.GitHub.Options;

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

Commands

CLI commandOptions record
gh agent-taskGhAgentTaskOptions
gh agent-task createGhAgentTaskCreateOptions
gh agent-task listGhAgentTaskListOptions
gh agent-task viewGhAgentTaskViewOptions
gh apiGhApiOptions
gh attestationGhAttestationOptions
gh attestation downloadGhAttestationDownloadOptions
gh attestation trusted-rootGhAttestationTrustedRootOptions
gh attestation verifyGhAttestationVerifyOptions
gh authGhAuthOptions
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 cacheGhCacheOptions
gh cache deleteGhCacheDeleteOptions
gh cache listGhCacheListOptions
gh codespaceGhCodespaceOptions
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 configGhConfigOptions
gh config clear-cacheGhConfigClearCacheOptions
gh config getGhConfigGetOptions
gh config listGhConfigListOptions
gh config setGhConfigSetOptions
gh copilotGhCopilotOptions
gh discussionGhDiscussionOptions
gh discussion commentGhDiscussionCommentOptions
gh discussion createGhDiscussionCreateOptions
gh discussion editGhDiscussionEditOptions
gh discussion listGhDiscussionListOptions
gh discussion viewGhDiscussionViewOptions
gh extensionGhExtensionOptions
gh extension browseGhExtensionBrowseOptions
gh extension createGhExtensionCreateOptions
gh extension installGhExtensionInstallOptions
gh extension listGhExtensionListOptions
gh extension removeGhExtensionRemoveOptions
gh extension searchGhExtensionSearchOptions
gh extension upgradeGhExtensionUpgradeOptions
gh gistGhGistOptions
gh gist cloneGhGistCloneOptions
gh gist createGhGistCreateOptions
gh gist deleteGhGistDeleteOptions
gh gist editGhGistEditOptions
gh gist listGhGistListOptions
gh gist renameGhGistRenameOptions
gh gist viewGhGistViewOptions
gh gpg-keyGhGpgKeyOptions
gh gpg-key addGhGpgKeyAddOptions
gh gpg-key deleteGhGpgKeyDeleteOptions
gh gpg-key listGhGpgKeyListOptions
gh issueGhIssueOptions
gh issue closeGhIssueCloseOptions
gh issue commentGhIssueCommentOptions
gh issue createGhIssueCreateOptions
gh issue deleteGhIssueDeleteOptions
gh issue developGhIssueDevelopOptions
gh issue editGhIssueEditOptions
gh issue listGhIssueListOptions
gh issue lockGhIssueLockOptions
gh issue pinGhIssuePinOptions
gh issue reopenGhIssueReopenOptions
gh issue statusGhIssueStatusOptions
gh issue transferGhIssueTransferOptions
gh issue unlockGhIssueUnlockOptions
gh issue unpinGhIssueUnpinOptions
gh issue viewGhIssueViewOptions
gh labelGhLabelOptions
gh label cloneGhLabelCloneOptions
gh label createGhLabelCreateOptions
gh label deleteGhLabelDeleteOptions
gh label editGhLabelEditOptions
gh label listGhLabelListOptions
gh licensesGhLicensesOptions
gh orgGhOrgOptions
gh org listGhOrgListOptions
gh prGhPrOptions
gh pr checkoutGhPrCheckoutOptions
gh pr checksGhPrChecksOptions
gh pr closeGhPrCloseOptions
gh pr commentGhPrCommentOptions
gh pr createGhPrCreateOptions
gh pr diffGhPrDiffOptions
gh pr editGhPrEditOptions
gh pr listGhPrListOptions
gh pr lockGhPrLockOptions
gh pr mergeGhPrMergeOptions
gh pr readyGhPrReadyOptions
gh pr reopenGhPrReopenOptions
gh pr revertGhPrRevertOptions
gh pr reviewGhPrReviewOptions
gh pr statusGhPrStatusOptions
gh pr unlockGhPrUnlockOptions
gh pr update-branchGhPrUpdateBranchOptions
gh pr viewGhPrViewOptions
gh previewGhPreviewOptions
gh preview prompterGhPreviewPrompterOptions
gh projectGhProjectOptions
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 release createGhReleaseCreateOptions
gh release deleteGhReleaseDeleteOptions
gh release delete-assetGhReleaseDeleteAssetOptions
gh release downloadGhReleaseDownloadOptions
gh release editGhReleaseEditOptions
gh release listGhReleaseListOptions
gh release uploadGhReleaseUploadOptions
gh release verifyGhReleaseVerifyOptions
gh release verify-assetGhReleaseVerifyAssetOptions
gh release viewGhReleaseViewOptions
gh repoGhRepoOptions
gh repo archiveGhRepoArchiveOptions
gh repo autolinkGhRepoAutolinkOptions
gh repo autolink createGhRepoAutolinkCreateOptions
gh repo autolink deleteGhRepoAutolinkDeleteOptions
gh repo autolink listGhRepoAutolinkListOptions
gh repo autolink viewGhRepoAutolinkViewOptions
gh repo cloneGhRepoCloneOptions
gh repo createGhRepoCreateOptions
gh repo deleteGhRepoDeleteOptions
gh repo deploy-keyGhRepoDeployKeyOptions
gh repo deploy-key addGhRepoDeployKeyAddOptions
gh repo deploy-key deleteGhRepoDeployKeyDeleteOptions
gh repo deploy-key listGhRepoDeployKeyListOptions
gh repo editGhRepoEditOptions
gh repo forkGhRepoForkOptions
gh repo gitignoreGhRepoGitignoreOptions
gh repo gitignore listGhRepoGitignoreListOptions
gh repo gitignore viewGhRepoGitignoreViewOptions
gh repo licenseGhRepoLicenseOptions
gh repo license listGhRepoLicenseListOptions
gh repo license viewGhRepoLicenseViewOptions
gh repo listGhRepoListOptions
gh repo read-dirGhRepoReadDirOptions
gh repo read-fileGhRepoReadFileOptions
gh repo renameGhRepoRenameOptions
gh repo set-defaultGhRepoSetDefaultOptions
gh repo syncGhRepoSyncOptions
gh repo unarchiveGhRepoUnarchiveOptions
gh repo viewGhRepoViewOptions
gh rulesetGhRulesetOptions
gh ruleset checkGhRulesetCheckOptions
gh ruleset listGhRulesetListOptions
gh ruleset viewGhRulesetViewOptions
gh runGhRunOptions
gh run cancelGhRunCancelOptions
gh run deleteGhRunDeleteOptions
gh run downloadGhRunDownloadOptions
gh run listGhRunListOptions
gh run rerunGhRunRerunOptions
gh run viewGhRunViewOptions
gh run watchGhRunWatchOptions
gh searchGhSearchOptions
gh search codeGhSearchCodeOptions
gh search commitsGhSearchCommitsOptions
gh search issuesGhSearchIssuesOptions
gh search prsGhSearchPrsOptions
gh search reposGhSearchReposOptions
gh secretGhSecretOptions
gh secret deleteGhSecretDeleteOptions
gh secret listGhSecretListOptions
gh secret setGhSecretSetOptions
gh skillGhSkillOptions
gh skill installGhSkillInstallOptions
gh skill listGhSkillListOptions
gh skill previewGhSkillPreviewOptions
gh skill publishGhSkillPublishOptions
gh skill searchGhSkillSearchOptions
gh skill updateGhSkillUpdateOptions
gh ssh-keyGhSshKeyOptions
gh ssh-key addGhSshKeyAddOptions
gh ssh-key deleteGhSshKeyDeleteOptions
gh ssh-key listGhSshKeyListOptions
gh statusGhStatusOptions
gh variableGhVariableOptions
gh variable deleteGhVariableDeleteOptions
gh variable getGhVariableGetOptions
gh variable listGhVariableListOptions
gh variable setGhVariableSetOptions
gh workflowGhWorkflowOptions
gh workflow disableGhWorkflowDisableOptions
gh workflow enableGhWorkflowEnableOptions
gh workflow listGhWorkflowListOptions
gh workflow runGhWorkflowRunOptions
gh workflow viewGhWorkflowViewOptions