gh
GitHub CLI
Installation
dagger install github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3Entrypoint
Return Type
Gh !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
| source | Directory | - | Git repository source (with .git directory). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
func (m *MyModule) Example() *dagger.Gh {
return dag.
Gh()
}@function
def example() -> dagger.Gh:
return (
dag.gh()
)@func()
example(): Gh {
return dag
.gh()
}Types
Gh 🔗
source() 🔗
Git repository source (with .git directory).
Return Type
Directory ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
sourcefunc (m *MyModule) Example() *dagger.Directory {
return dag.
Gh().
Source()
}@function
def example() -> dagger.Directory:
return (
dag.gh()
.source()
)@func()
example(): Directory {
return dag
.gh()
.source()
}repo() 🔗
Work with GitHub repositories.
Return Type
Repo ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
repofunc (m *MyModule) Example() *dagger.GhRepo {
return dag.
Gh().
Repo()
}@function
def example() -> dagger.GhRepo:
return (
dag.gh()
.repo()
)@func()
example(): GhRepo {
return dag
.gh()
.repo()
}withToken() 🔗
Set a GitHub token.
Return Type
Gh !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| token | Secret ! | - | GitHub token. |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
with-token --token env:MYSECRETfunc (m *MyModule) Example(token *dagger.Secret) *dagger.Gh {
return dag.
Gh().
WithToken(token)
}@function
def example(token: dagger.Secret) -> dagger.Gh:
return (
dag.gh()
.with_token(token)
)@func()
example(token: Secret): Gh {
return dag
.gh()
.withToken(token)
}withRepo() 🔗
Set a GitHub repository as context.
Return Type
Gh !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repo | String ! | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
with-repo --repo stringfunc (m *MyModule) Example(repo string) *dagger.Gh {
return dag.
Gh().
WithRepo(repo)
}@function
def example(repo: str) -> dagger.Gh:
return (
dag.gh()
.with_repo(repo)
)@func()
example(repo: string): Gh {
return dag
.gh()
.withRepo(repo)
}withSource() 🔗
Load a Git repository source (with .git directory).
Return Type
Gh !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | Git repository source (with .git directory). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
with-source --source DIR_PATHfunc (m *MyModule) Example(source *dagger.Directory) *dagger.Gh {
return dag.
Gh().
WithSource(source)
}@function
def example(source: dagger.Directory) -> dagger.Gh:
return (
dag.gh()
.with_source(source)
)@func()
example(source: Directory): Gh {
return dag
.gh()
.withSource(source)
}clone() 🔗
Clone a GitHub repository.
Return Type
Gh !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
clonefunc (m *MyModule) Example() *dagger.Gh {
return dag.
Gh().
Clone()
}@function
def example() -> dagger.Gh:
return (
dag.gh()
.clone()
)@func()
example(): Gh {
return dag
.gh()
.clone()
}run() 🔗
Run a GitHub CLI command (accepts a single command string without “gh”).
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| cmd | String ! | - | Command to run. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
run --cmd stringfunc (m *MyModule) Example(cmd string) *dagger.Container {
return dag.
Gh().
Run(cmd)
}@function
def example(cmd: str) -> dagger.Container:
return (
dag.gh()
.run(cmd)
)@func()
example(cmd: string): Container {
return dag
.gh()
.run(cmd)
}exec() 🔗
Run a GitHub CLI command (accepts a list of arguments without “gh”).
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| args | [String ! ] ! | - | Arguments to pass to GitHub CLI. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
exec --args string1 --args string2func (m *MyModule) Example(args []string) *dagger.Container {
return dag.
Gh().
Exec(args)
}@function
def example(args: List[str]) -> dagger.Container:
return (
dag.gh()
.exec(args)
)@func()
example(args: string[]): Container {
return dag
.gh()
.exec(args)
}withGitExec() 🔗
Run a git command (accepts a list of arguments without “git”).
Return Type
Gh !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| args | [String ! ] ! | - | Arguments to pass to GitHub CLI. |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
with-git-exec --args string1 --args string2func (m *MyModule) Example(args []string) *dagger.Gh {
return dag.
Gh().
WithGitExec(args)
}@function
def example(args: List[str]) -> dagger.Gh:
return (
dag.gh()
.with_git_exec(args)
)@func()
example(args: string[]): Gh {
return dag
.gh()
.withGitExec(args)
}terminal() 🔗
Open an interactive terminal.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
terminalfunc (m *MyModule) Example() *dagger.Container {
return dag.
Gh().
Terminal()
}@function
def example() -> dagger.Container:
return (
dag.gh()
.terminal()
)@func()
example(): Container {
return dag
.gh()
.terminal()
}pullRequest() 🔗
Work with GitHub pull requests.
Return Type
PullRequest ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-requestfunc (m *MyModule) Example() *dagger.GhPullRequest {
return dag.
Gh().
PullRequest()
}@function
def example() -> dagger.GhPullRequest:
return (
dag.gh()
.pull_request()
)@func()
example(): GhPullRequest {
return dag
.gh()
.pullRequest()
}release() 🔗
Manage releases.
Return Type
Release ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
releasefunc (m *MyModule) Example() *dagger.GhRelease {
return dag.
Gh().
Release()
}@function
def example() -> dagger.GhRelease:
return (
dag.gh()
.release()
)@func()
example(): GhRelease {
return dag
.gh()
.release()
}Repo 🔗
clone() 🔗
Clone a GitHub repository locally.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repository | String ! | - | No description provided |
| args | [String ! ] | - | Additional arguments to pass to the "git clone" command. |
| token | Secret | - | GitHub token. |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
repo \
clone --repository stringfunc (m *MyModule) Example(repository string) *dagger.Directory {
return dag.
Gh().
Repo().
Clone(repository)
}@function
def example(repository: str) -> dagger.Directory:
return (
dag.gh()
.repo()
.clone(repository)
)@func()
example(repository: string): Directory {
return dag
.gh()
.repo()
.clone(repository)
}PullRequest 🔗
create() 🔗
Create a pull request on GitHub.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| assignees | [String ! ] | - | Assign people by their login. Use "@me" to self-assign. |
| base | String | - | The branch into which you want your code merged. |
| body | String | - | Body for the pull request. |
| bodyFile | File | - | Read body text from file. |
| draft | Boolean | - | Mark pull request as a draft. |
| fill | Boolean | - | Use commit info for title and body. (Requires repository source) |
| fillFirst | Boolean | - | Use first commit info for title and body. (Requires repository source) |
| fillVerbose | Boolean | - | Use commits msg+body for description. (Requires repository source) |
| head | String | - | The branch that contains commits for your pull request (default [current branch], required when no repository source is available). |
| labels | [String ! ] | - | Add labels by name. |
| milestone | String | - | Add the pull request to a milestone by name. |
| noMaintainerEdit | Boolean | - | Disable maintainer's ability to modify pull request. |
| projects | [String ! ] | - | Add the pull request to projects by name. |
| reviewers | [String ! ] | - | Request reviews from people or teams by their handle. |
| template | File | - | Template file to use as starting body text. |
| title | String | - | Title for the pull request. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
createfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Gh().
PullRequest().
Create(ctx)
}@function
async def example() -> None:
return await (
dag.gh()
.pull_request()
.create()
)@func()
async example(): Promise<void> {
return dag
.gh()
.pullRequest()
.create()
}close() 🔗
Close a pull request on GitHub.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| pullRequest | String | - | Pull request number to close. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
| comment | String | - | Add a comment when closing the pull request. |
| deleteBranch | Boolean | - | Delete the local and remote branch after closing. |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
closefunc (m *MyModule) Example(ctx context.Context) {
return dag.
Gh().
PullRequest().
Close(ctx)
}@function
async def example() -> None:
return await (
dag.gh()
.pull_request()
.close()
)@func()
async example(): Promise<void> {
return dag
.gh()
.pullRequest()
.close()
}exists() 🔗
Check if a PR exists
Return Type
Boolean !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| pullRequest | String ! | - | Pull request number, url or branch name. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
exists --pull-request stringfunc (m *MyModule) Example(ctx context.Context, pullRequest string) bool {
return dag.
Gh().
PullRequest().
Exists(ctx, pullRequest)
}@function
async def example(pull_request: str) -> bool:
return await (
dag.gh()
.pull_request()
.exists(pull_request)
)@func()
async example(pullRequest: string): Promise<boolean> {
return dag
.gh()
.pullRequest()
.exists(pullRequest)
}review() 🔗
Add a review to a pull request.
Return Type
PullRequestReview !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| pullRequest | String ! | - | Pull request number, url or branch name. |
| body | String | - | Specify the body of a review. |
| bodyFile | File | - | Read body text from file. |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
review --pull-request stringfunc (m *MyModule) Example(pullRequest string) *dagger.GhPullRequestReview {
return dag.
Gh().
PullRequest().
Review(pullRequest)
}@function
def example(pull_request: str) -> dagger.GhPullRequestReview:
return (
dag.gh()
.pull_request()
.review(pull_request)
)@func()
example(pullRequest: string): GhPullRequestReview {
return dag
.gh()
.pullRequest()
.review(pullRequest)
}list() 🔗
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| state | String | - | Filter by pull request state: {open|closed|merged|all}. |
| base | String | - | Filter by pull request base branch. |
| head | String | - | Filter by head branch. |
| headRegex | String | - | Filter by head branch using regex pattern. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
listfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Gh().
PullRequest().
List(ctx)
}@function
async def example() -> str:
return await (
dag.gh()
.pull_request()
.list()
)@func()
async example(): Promise<string> {
return dag
.gh()
.pullRequest()
.list()
}update() 🔗
Update an existing pull request on GitHub.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| pullRequest | String | - | Pull request number to update. |
| assignees | [String ! ] | - | Assign people by their login. Use "@me" to self-assign. |
| base | String | - | The branch into which you want your code merged. |
| body | String | - | Body for the pull request. |
| bodyFile | File | - | Read body text from file. |
| labels | [String ! ] | - | Add labels by name. |
| milestone | String | - | Add the pull request to a milestone by name. |
| projects | [String ! ] | - | Add the pull request to projects by name. |
| reviewers | [String ! ] | - | Request reviews from people or teams by their handle. |
| title | String | - | Title for the pull request. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
updatefunc (m *MyModule) Example(ctx context.Context) {
return dag.
Gh().
PullRequest().
Update(ctx)
}@function
async def example() -> None:
return await (
dag.gh()
.pull_request()
.update()
)@func()
async example(): Promise<void> {
return dag
.gh()
.pullRequest()
.update()
}Release 🔗
create() 🔗
Create a new GitHub Release for a repository.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| tag | String ! | - | Tag this release should point to or create. |
| title | String ! | - | Release title. |
| files | [File ! ] | - | Release assets to upload. |
| draft | Boolean | - | Save the release as a draft instead of publishing it. |
| preRelease | Boolean | - | Mark the release as a prerelease. |
| target | String | - | Target branch or full commit SHA (default: main branch). |
| notes | String | - | Release notes. |
| notesFile | File | - | Read release notes from file. |
| discussionCategory | String | - | Start a discussion in the specified category. |
| generateNotes | Boolean | - | Automatically generate title and notes for the release. |
| notesStartTag | String | - | Tag to use as the starting point for generating release notes. |
| latest | Enum | "LATEST_AUTO" | Mark this release as "Latest" (default: automatic based on date and version). |
| verifyTag | Boolean | - | Abort in case the git tag doesn't already exist in the remote repository. |
| notesFromTag | Boolean | - | Tag to use as the starting point for generating release notes. |
| token | Secret | - | GitHub token. |
| repo | String | - | GitHub repository (e.g. "owner/repo"). |
Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
release \
create --tag string --title stringfunc (m *MyModule) Example(ctx context.Context, tag string, title string) {
return dag.
Gh().
Release().
Create(ctx, tag, title)
}@function
async def example(tag: str, title: str) -> None:
return await (
dag.gh()
.release()
.create(tag, title)
)@func()
async example(tag: string, title: string): Promise<void> {
return dag
.gh()
.release()
.create(tag, title)
}PullRequestReview 🔗
TODO: revisit if these should be private
approve() 🔗
Approve a pull request.
Return Type
Void ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
review --pull-request string \
approvefunc (m *MyModule) Example(ctx context.Context, pullRequest string) {
return dag.
Gh().
PullRequest().
Review(pullRequest).
Approve(ctx)
}@function
async def example(pull_request: str) -> None:
return await (
dag.gh()
.pull_request()
.review(pull_request)
.approve()
)@func()
async example(pullRequest: string): Promise<void> {
return dag
.gh()
.pullRequest()
.review(pullRequest)
.approve()
}comment() 🔗
Comment on a pull request.
Return Type
Void ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
review --pull-request string \
commentfunc (m *MyModule) Example(ctx context.Context, pullRequest string) {
return dag.
Gh().
PullRequest().
Review(pullRequest).
Comment(ctx)
}@function
async def example(pull_request: str) -> None:
return await (
dag.gh()
.pull_request()
.review(pull_request)
.comment()
)@func()
async example(pullRequest: string): Promise<void> {
return dag
.gh()
.pullRequest()
.review(pullRequest)
.comment()
}requestChanges() 🔗
Request changes on a pull request.
Return Type
Void ! Example
dagger -m github.com/luanmtruong/daggerverse/gh@d9828cf81c59619c179304cde628f2fa3c74def3 call \
pull-request \
review --pull-request string \
request-changesfunc (m *MyModule) Example(ctx context.Context, pullRequest string) {
return dag.
Gh().
PullRequest().
Review(pullRequest).
RequestChanges(ctx)
}@function
async def example(pull_request: str) -> None:
return await (
dag.gh()
.pull_request()
.review(pull_request)
.request_changes()
)@func()
async example(pullRequest: string): Promise<void> {
return dag
.gh()
.pullRequest()
.review(pullRequest)
.requestChanges()
}