aining a hyphen, run %[1]sgh search --help%[1]s.
Verify that a GitHub Release is accompanied by a valid cryptographically signed attestation.
An attestation is a claim made by GitHub regarding a release and its assets.
This command checks that the specified release (or the latest release, if no tag is given) has a valid attestation.
It fetches the attestation for the release and prints metadata about all assets referenced in the attestation, including their digests.
plaintext
text
plain
no-highlight
*.txt
text/plain
-1
# Interactively select a default repository
$ gh repo set-default
# Set a repository explicitly
$ gh repo set-default owner/repo
# Set a repository using a git remote name
$ gh repo set-default origin
# View the current default repository
$ gh repo set-default --view
# Show more repository options in the interactive picker
$ git remote add newrepo https://github.com/owner/repo
$ gh repo set-default
Set a value for a variable on one of the following levels:
- repository (default): available to GitHub Actions runs or Dependabot in a repository
- environment: available to GitHub Actions runs for a deployment environment in a repository
- organization: available to GitHub Actions runs or Dependabot within an organization
Organization variable can optionally be restricted to only be available to
specific repositories.
View information about GitHub rules that apply to a given branch.
The provided branch name does not need to exist; rules will be displayed that would apply
to a branch with that name. All rules are returned regardless of where they are configured.
If no branch name is provided, then the current branch will be used.
The %[1]s--default%[1]s flag can be used to view rules that apply to the default branch of the
repository.
Merge a pull request on GitHub.
Without an argument, the pull request that belongs to the current branch
is selected.
When targeting a branch that requires a merge queue, no merge strategy is required.
If required checks have not yet passed, auto-merge will be enabled.
If required checks have passed, the pull request will be added to the merge queue.
To bypass a merge queue and merge directly, pass the %[1]s--admin%[1]s flag.
Edit one or more issues within the same repository.
Editing issues' projects requires authorization with the %[1]sproject%[1]s scope.
To authorize, run %[1]sgh auth refresh -s project%[1]s.
The %[1]s--add-assignee%[1]s and %[1]s--remove-assignee%[1]s flags both support
the following special values:
- %[1]s@me%[1]s: assign or unassign yourself
- %[1]s@copilot%[1]s: assign or unassign Copilot (not supported on GitHub Enterprise Server)
# Create an alphanumeric autolink to example.com for the key prefix "TICKET-".
# Generates https://example.com/TICKET?query=123abc from "TICKET-123abc".
$ gh repo autolink create TICKET- "https://example.com/TICKET?query="
# Create a numeric autolink to example.com for the key prefix "STORY-".
# Generates https://example.com/STORY?id=123 from "STORY-123".
$ gh repo autolink create STORY- "https://example.com/STORY?id=" --numeric
# List the items in the current users's project "1"
$ gh project item-list 1 --owner "@me"
# List items assigned to a specific user
$ gh project item-list 1 --owner "@me" --query "assignee:monalisa"
# List open issues assigned to yourself
$ gh project item-list 1 --owner "@me" --query "assignee:@me is:issue is:open"
# List items with the "bug" label that are not done
$ gh project item-list 1 --owner "@me" --query "label:bug -status:Done"
query OrgRulesetList($limit: Int!, $endCursor: String, $includeParents: Boolean, $login: String!) {
level: organization(login: $login) {
rulesets(first: $limit, after: $endCursor, includeParents: $includeParents) {
totalCount
nodes {
databaseId
name
target
enforcement
source {
__typename
... on Repository { owner: nameWithOwner }
... on Organization { owner: login }
}
rules {
totalCount
}
}
pageInfo {
hasNextPage
endCursor
}
}}}
# View an agent task by session ID
$ gh agent-task view e2fa49d2-f164-4a56-ab99-498090b8fcdf
# View an agent task by pull request number in current repo
$ gh agent-task view 12345
# View an agent task by pull request number
$ gh agent-task view --repo OWNER/REPO 12345
# View an agent task by pull request reference
$ gh agent-task view OWNER/REPO#12345
# View a pull request agents tasks in the browser
$ gh agent-task view 12345 --web
A task can be identified as argument in any of the following formats:
- by pull request number, e.g. "123"; or
- by session ID, e.g. "12345abc-12345-12345-12345-12345abc"; or
- by URL, e.g. "https://github.com/OWNER/REPO/pull/123/agent-sessions/12345abc-12345-12345-12345-12345abc";
Identifying tasks by pull request is not recommended for non-interactive use cases as
there may be multiple tasks for a given pull request that require disambiguation.
# Clone a repository from a specific org
$ gh repo clone cli/cli
# Clone a repository from your own account
$ gh repo clone myrepo
# Clone a repo, overriding git protocol configuration
$ gh repo clone https://github.com/cli/cli
$ gh repo clone git@github.com:cli/cli.git
# Clone a repository to a custom directory
$ gh repo clone cli/cli workspace/cli
# Clone a repository with additional git clone flags
$ gh repo clone cli/cli -- --depth=1
# Interactively select a run to view, optionally selecting a single job
$ gh run view
# View a specific run
$ gh run view 12345
# View a specific run with specific attempt number
$ gh run view 12345 --attempt 3
# View a specific job within a run
$ gh run view --job 456789
# View the full log for a specific job
$ gh run view --log --job 456789
# Exit non-zero if a run failed
$ gh run view 0451 --exit-status && echo "run pending or passed"
List recent workflow runs.
Note that providing the %[1]sworkflow_name%[1]s to the %[1]s-w%[1]s flag will not fetch disabled workflows.
Also pass the %[1]s-a%[1]s flag to fetch disabled workflow runs using the %[1]sworkflow_name%[1]s and the %[1]s-w%[1]s flag.
Runs created by organization and enterprise ruleset workflows will not display a workflow name due to GitHub API limitations.
To see runs associated with a pull request, users should run %[1]sgh pr checks%[1]s.
package main
import (
"fmt"
"github.com/cli/go-gh/v2/pkg/api"
)
func main() {
fmt.Println("hi world, this is the %s extension!")
client, err := api.DefaultRESTClient()
if err != nil {
fmt.Println(err)
return
}
response := struct {Login string}{}
err = client.Get("user", &response)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("running as %%s\n", response.Login)
}
// For more examples of using go-gh, see:
// https://github.com/cli/go-gh/blob/trunk/example_gh_test.go
query RepoRulesetList($limit: Int!, $endCursor: String, $includeParents: Boolean, $owner: String!, $repo: String!) {
level: repository(owner: $owner, name: $repo) {
rulesets(first: $limit, after: $endCursor, includeParents: $includeParents) {
totalCount
nodes {
databaseId
name
target
enforcement
source {
__typename
... on Repository { owner: nameWithOwner }
... on Organization { owner: login }
}
rules {
totalCount
}
}
pageInfo {
hasNextPage
endCursor
}
}}}
Switch the active account for a GitHub host.
This command changes the authentication configuration that will
be used when running commands targeting the specified GitHub host.
If the specified host has two accounts, the active account will be switched
automatically. If there are more than two accounts, disambiguation will be
required either through the %[1]s--user%[1]s flag or an interactive prompt.
For a list of authenticated accounts you can run %[1]sgh auth status%[1]s.
# List branches for issue 123
$ gh issue develop --list 123
# List branches for issue 123 in repo cli/cli
$ gh issue develop --list --repo cli/cli 123
# Create a branch for issue 123 based on the my-feature branch
$ gh issue develop 123 --base my-feature
# Create a branch for issue 123 and check it out
$ gh issue develop 123 --checkout
# Create a branch in repo monalisa/cli for issue 123 in repo cli/cli
$ gh issue develop 123 --repo cli/cli --branch-repo monalisa/cli
fragment issue on Issue {
__typename
updatedAt
title
number
repository {
nameWithOwner
}
}
fragment pr on PullRequest {
__typename
updatedAt
title
number
repository {
nameWithOwner
}
}
query AssignedSearch($searchAssigns: String!, $searchReviews: String!, $limit: Int = 25) {
assignments: search(first: $limit, type: ISSUE, query: $searchAssigns) {
nodes {
...issue
...pr
}
}
reviewRequested: search(first: $limit, type: ISSUE, query: $searchReviews) {
nodes {
...pr
}
}
}FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF
Download artifacts generated by a GitHub Actions workflow run.
The contents of each artifact will be extracted under separate directories based on
the artifact name. If only a single artifact is specified, it will be extracted into
the current directory.
By default, this command downloads the latest artifact created and uploaded through
GitHub Actions. Because workflows can delete or overwrite artifacts, %[1]s%[1]s
must be used to select an artifact from a specific workflow run.