gh
GitHub CLI
Installation
dagger install github.com/sagikazarmark/daggerverse/gh@v0.10.0
Entrypoint
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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
func (m *myModule) example() *Gh {
return dag.
Gh()
}
@function
def example() -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
source
func (m *myModule) example() *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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
repo
func (m *myModule) example() *GhRepo {
return dag.
Gh().
Repo()
}
@function
def example() -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
with-token --token env:MYSECRET
func (m *myModule) example(token *Secret) *Gh {
return dag.
Gh().
WithToken(token)
}
@function
def example(token: dagger.Secret) -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
with-repo --repo string
func (m *myModule) example(repo string) *Gh {
return dag.
Gh().
WithRepo(repo)
}
@function
def example(repo: str) -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
with-source --source DIR_PATH
func (m *myModule) example(source *Directory) *Gh {
return dag.
Gh().
WithSource(source)
}
@function
def example(source: dagger.Directory) -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
clone
func (m *myModule) example() *Gh {
return dag.
Gh().
Clone()
}
@function
def example() -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
run --cmd string
func (m *myModule) example(cmd string) *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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
exec --args string1 --args string2
func (m *myModule) example(args []string) *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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
with-git-exec --args string1 --args string2
func (m *myModule) example(args []string) *Gh {
return dag.
Gh().
WithGitExec(args)
}
@function
def example(args: List[str]) -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
terminal
func (m *myModule) example() *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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request
func (m *myModule) example() *GhPullRequest {
return dag.
Gh().
PullRequest()
}
@function
def example() -> dag.GhPullRequest:
return (
dag.gh()
.pull_request()
)
@func()
example(): GhPullRequest {
return dag
.gh()
.pullRequest()
}
release() 🔗
Manage releases.
Return Type
Release !
Example
dagger -m github.com/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
release
func (m *myModule) example() *GhRelease {
return dag.
Gh().
Release()
}
@function
def example() -> dag.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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
repo \
clone --repository string
func (m *myModule) example(repository string) *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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request \
create
func (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()
}
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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request \
exists --pull-request string
func (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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request \
review --pull-request string
func (m *myModule) example(pullRequest string) *GhPullRequestReview {
return dag.
Gh().
PullRequest().
Review(pullRequest)
}
@function
def example(pull_request: str) -> dag.GhPullRequestReview:
return (
dag.gh()
.pull_request()
.review(pull_request)
)
@func()
example(pullRequest: string): GhPullRequestReview {
return dag
.gh()
.pullRequest()
.review(pullRequest)
}
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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
release \
create --tag string --title string
func (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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request \
review --pull-request string \
approve
func (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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request \
review --pull-request string \
comment
func (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/sagikazarmark/daggerverse/gh@dd693e9bbb102b9e3779a451f9db8901977880d6 call \
pull-request \
review --pull-request string \
request-changes
func (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()
}