Dagger
Search

git

No long description provided.

Installation

dagger install github.com/stuttgart-things/dagger/git@v0.49.8

Entrypoint

Return Type
Git
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
func (m *MyModule) Example() *dagger.Git  {
	return dag.
			Git()
}
@function
def example() -> dagger.Git:
	return (
		dag.git()
	)
@func()
example(): Git {
	return dag
		.git()
}

Types

Git 🔗

baseImage() 🔗

Return Type
String !
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 base-image
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Git().
			BaseImage(ctx)
}
@function
async def example() -> str:
	return await (
		dag.git()
		.base_image()
	)
@func()
async example(): Promise<string> {
	return dag
		.git()
		.baseImage()
}

createGithubBranch() 🔗

CreateGithubBranch creates a new branch in a GitHub repository based on an existing ref. If the branch already exists, it returns an error. Returns the name of the created branch.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
newBranchString !-Name of the new branch to create
baseBranchString "main"Base ref/branch to create from (e.g., "main", "develop")
tokenSecret !-GitHub token for authentication
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 create-github-branch --repository string --new-branch string --token env:MYSECRET
func (m *MyModule) Example(ctx context.Context, repository string, newBranch string, token *dagger.Secret) string  {
	return dag.
			Git().
			CreateGithubBranch(ctx, repository, newBranch, token)
}
@function
async def example(repository: str, new_branch: str, token: dagger.Secret) -> str:
	return await (
		dag.git()
		.create_github_branch(repository, new_branch, token)
	)
@func()
async example(repository: string, newBranch: string, token: Secret): Promise<string> {
	return dag
		.git()
		.createGithubBranch(repository, newBranch, token)
}

deleteGithubBranch() 🔗

DeleteGithubBranch deletes a branch from a GitHub repository. This will delete the branch from the remote repository. Returns a success message with the deleted branch name.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
branchString !-Name of the branch to delete
tokenSecret !-GitHub token for authentication
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 delete-github-branch --repository string --branch string --token env:MYSECRET
func (m *MyModule) Example(ctx context.Context, repository string, branch string, token *dagger.Secret) string  {
	return dag.
			Git().
			DeleteGithubBranch(ctx, repository, branch, token)
}
@function
async def example(repository: str, branch: str, token: dagger.Secret) -> str:
	return await (
		dag.git()
		.delete_github_branch(repository, branch, token)
	)
@func()
async example(repository: string, branch: string, token: Secret): Promise<string> {
	return dag
		.git()
		.deleteGithubBranch(repository, branch, token)
}

createGithubPullRequest() 🔗

CreateGithubPullRequest creates a new pull request in a GitHub repository. It uses the GitHub CLI to create a PR from the head branch to the base branch. Returns the URL of the created pull request.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
headBranchString !-Head branch (the branch with your changes)
baseBranchString "main"Base branch to merge into (e.g., "main", "develop")
titleString !-Pull request title
bodyString !-Pull request body/description
labels[String ! ] -Optional labels to add to the PR
reviewers[String ! ] -Optional reviewers to request
tokenSecret !-GitHub token for authentication
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 create-github-pull-request --repository string --head-branch string --title string --body string --token env:MYSECRET
func (m *MyModule) Example(ctx context.Context, repository string, headBranch string, title string, body string, token *dagger.Secret) string  {
	return dag.
			Git().
			CreateGithubPullRequest(ctx, repository, headBranch, title, body, token)
}
@function
async def example(repository: str, head_branch: str, title: str, body: str, token: dagger.Secret) -> str:
	return await (
		dag.git()
		.create_github_pull_request(repository, head_branch, title, body, token)
	)
@func()
async example(repository: string, headBranch: string, title: string, body: string, token: Secret): Promise<string> {
	return dag
		.git()
		.createGithubPullRequest(repository, headBranch, title, body, token)
}

createGithubIssue() 🔗

CreateGithubIssue creates a new GitHub issue in the specified repository. It clones the repository, authenticates using the provided token, and uses the GitHub CLI to create an issue with the given title, body, optional labels, and optional assignees. Returns the URL of the created issue.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
refString "main"Ref/Branch to checkout - If not specified, defaults to "main"
titleString !-No description provided
bodyString !-No description provided
labelString -No description provided
assignees[String ! ] -No description provided
tokenSecret !-GitHub token for authentication
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 create-github-issue --repository string --title string --body string --token env:MYSECRET
func (m *MyModule) Example(ctx context.Context, repository string, title string, body string, token *dagger.Secret) string  {
	return dag.
			Git().
			CreateGithubIssue(ctx, repository, title, body, token)
}
@function
async def example(repository: str, title: str, body: str, token: dagger.Secret) -> str:
	return await (
		dag.git()
		.create_github_issue(repository, title, body, token)
	)
@func()
async example(repository: string, title: string, body: string, token: Secret): Promise<string> {
	return dag
		.git()
		.createGithubIssue(repository, title, body, token)
}

cloneGithub() 🔗

CloneGithub clones a GitHub repository and checks out the specified branch or ref. It uses the GitHub CLI to perform the clone operation with authentication, then checks out the requested ref/branch. Returns a Dagger Directory containing the cloned repository at the specified ref.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
repositoryString !-No description provided
refString "main"Ref/Branch to checkout - If not specified, defaults to "main"
tokenSecret !-No description provided
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 clone-github --repository string --token env:MYSECRET
func (m *MyModule) Example(repository string, token *dagger.Secret) *dagger.Directory  {
	return dag.
			Git().
			CloneGithub(repository, token)
}
@function
def example(repository: str, token: dagger.Secret) -> dagger.Directory:
	return (
		dag.git()
		.clone_github(repository, token)
	)
@func()
example(repository: string, token: Secret): Directory {
	return dag
		.git()
		.cloneGithub(repository, token)
}

addFileToGithubBranch() 🔗

AddFileToPath adds a single file to a specific path in a remote branch. This is useful when you need to add or update individual files at precise locations within the repository structure. Returns the commit SHA of the created commit.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
branchString !-Branch name to add files to
commitMessageString !-Commit message
tokenSecret !-GitHub token for authentication
sourceFileFile !-Source file to copy
destinationPathString !-Destination path within the repository (e.g., "docs/README.md" or "config.yaml")
authorNameString "Dagger Bot"Git author name
authorEmailString "bot@dagger.io"Git author email
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 add-file-to-github-branch --repository string --branch string --commit-message string --token env:MYSECRET --source-file file:path --destination-path string
func (m *MyModule) Example(ctx context.Context, repository string, branch string, commitMessage string, token *dagger.Secret, sourceFile *dagger.File, destinationPath string) string  {
	return dag.
			Git().
			AddFileToGithubBranch(ctx, repository, branch, commitMessage, token, sourceFile, destinationPath)
}
@function
async def example(repository: str, branch: str, commit_message: str, token: dagger.Secret, source_file: dagger.File, destination_path: str) -> str:
	return await (
		dag.git()
		.add_file_to_github_branch(repository, branch, commit_message, token, source_file, destination_path)
	)
@func()
async example(repository: string, branch: string, commitMessage: string, token: Secret, sourceFile: File, destinationPath: string): Promise<string> {
	return dag
		.git()
		.addFileToGithubBranch(repository, branch, commitMessage, token, sourceFile, destinationPath)
}

addFolderToGithubBranch() 🔗

AddFolderToGithubBranch adds a folder to a specific path in a remote branch. This allows you to place a directory and its contents at a specific location within the repository structure. Returns the commit SHA of the created commit.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
branchString !-Branch name to add files to
commitMessageString !-Commit message
tokenSecret !-GitHub token for authentication
sourceDirDirectory !-Source directory containing files to copy
destinationPathString !-Destination path within the repository (e.g., "docs/" or "src/config/")
authorNameString "Dagger Bot"Git author name
authorEmailString "bot@dagger.io"Git author email
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 add-folder-to-github-branch --repository string --branch string --commit-message string --token env:MYSECRET --source-dir DIR_PATH --destination-path string
func (m *MyModule) Example(ctx context.Context, repository string, branch string, commitMessage string, token *dagger.Secret, sourceDir *dagger.Directory, destinationPath string) string  {
	return dag.
			Git().
			AddFolderToGithubBranch(ctx, repository, branch, commitMessage, token, sourceDir, destinationPath)
}
@function
async def example(repository: str, branch: str, commit_message: str, token: dagger.Secret, source_dir: dagger.Directory, destination_path: str) -> str:
	return await (
		dag.git()
		.add_folder_to_github_branch(repository, branch, commit_message, token, source_dir, destination_path)
	)
@func()
async example(repository: string, branch: string, commitMessage: string, token: Secret, sourceDir: Directory, destinationPath: string): Promise<string> {
	return dag
		.git()
		.addFolderToGithubBranch(repository, branch, commitMessage, token, sourceDir, destinationPath)
}

addFilesToGithubBranch() 🔗

AddFilesToGithubBranch adds multiple files or directories to specific paths in a remote branch. This allows you to place files at different locations within the repository structure. Each file or directory is copied to its specified destination path before committing and pushing. Returns the commit SHA of the created commit.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryString !-Repository in format "owner/repo"
branchString !-Branch name to add files to
commitMessageString !-Commit message
tokenSecret !-GitHub token for authentication
sourceDirDirectory !-Source directory containing file to copy
destinationPathString !-Destination path within the repository (e.g., "docs/README.md" or "src/config/")
authorNameString "Dagger Bot"Git author name
authorEmailString "bot@dagger.io"Git author email
Example
dagger -m github.com/stuttgart-things/dagger/git@b9ca65215cae2299c0035e23284096f103ad1f70 call \
 add-files-to-github-branch --repository string --branch string --commit-message string --token env:MYSECRET --source-dir DIR_PATH --destination-path string
func (m *MyModule) Example(ctx context.Context, repository string, branch string, commitMessage string, token *dagger.Secret, sourceDir *dagger.Directory, destinationPath string) string  {
	return dag.
			Git().
			AddFilesToGithubBranch(ctx, repository, branch, commitMessage, token, sourceDir, destinationPath)
}
@function
async def example(repository: str, branch: str, commit_message: str, token: dagger.Secret, source_dir: dagger.Directory, destination_path: str) -> str:
	return await (
		dag.git()
		.add_files_to_github_branch(repository, branch, commit_message, token, source_dir, destination_path)
	)
@func()
async example(repository: string, branch: string, commitMessage: string, token: Secret, sourceDir: Directory, destinationPath: string): Promise<string> {
	return dag
		.git()
		.addFilesToGithubBranch(repository, branch, commitMessage, token, sourceDir, destinationPath)
}