Dagger
Search

git-actions

The main focus is to work with a Git Repository by SSH authentication.

The Git Actions module is used in following example repository: https://github.com/puzzle/dagger-module-gitops/

Installation

dagger install github.com/puzzle/dagger-module-git-actions/git-actions@v0.9.0

Entrypoint

Return Type
GitActions
Example
func (m *myModule) example() *GitActions  {
	return dag.
			GitActions()
}
@function
def example() -> dag.GitActions:
	return (
		dag.git_actions()
	)
@func()
example(): GitActions {
	return dag
		.gitActions()
}

Types

GitActions

withRepository()

Configure Git repository access with ssh key

Return Type
GitActionsGitActionRepository !
Arguments
NameTypeDefault ValueDescription
repoUrlString !-URL of the Git repository
sshKeyFile !-SSH key with access credentials for the Git repository
Example
dagger -m github.com/puzzle/dagger-module-git-actions/git-actions@ba354569d342d9ce311cadad88391048c610d584 call \
 with-repository --repo-url string --ssh-key file:path \
 clone-ssh
func (m *myModule) example(repoUrl string, sshKey *File) *GitActionsGitActionRepository  {
	return dag.
			GitActions().
			WithRepository(repoUrl, sshKey)
}
@function
def example(repo_url: str, ssh_key: dagger.File) -> dag.GitActionsGitActionRepository:
	return (
		dag.git_actions()
		.with_repository(repo_url, ssh_key)
	)
@func()
example(repoUrl: string, sshKey: File): GitActionsGitActionRepository {
	return dag
		.gitActions()
		.withRepository(repoUrl, sshKey)
}

GitActionsGitActionRepository

repoUrl()

URL of the Git repository

Return Type
String !
Example
dagger -m github.com/puzzle/dagger-module-git-actions/git-actions@ba354569d342d9ce311cadad88391048c610d584 call \
 with-repository --repo-url string --ssh-key file:path \
 repo-url
func (m *myModule) example(ctx context.Context, repoUrl string, sshKey *File) string  {
	return dag.
			GitActions().
			WithRepository(repoUrl, sshKey).
			RepoUrl(ctx)
}
@function
async def example(repo_url: str, ssh_key: dagger.File) -> str:
	return await (
		dag.git_actions()
		.with_repository(repo_url, ssh_key)
		.repo_url()
	)
@func()
async example(repoUrl: string, sshKey: File): Promise<string> {
	return dag
		.gitActions()
		.withRepository(repoUrl, sshKey)
		.repoUrl()
}

sshKey()

SSH key with access credentials for the Git repository

Return Type
File !
Example
dagger -m github.com/puzzle/dagger-module-git-actions/git-actions@ba354569d342d9ce311cadad88391048c610d584 call \
 with-repository --repo-url string --ssh-key file:path \
 ssh-key
func (m *myModule) example(repoUrl string, sshKey *File) *File  {
	return dag.
			GitActions().
			WithRepository(repoUrl, sshKey).
			SshKey()
}
@function
def example(repo_url: str, ssh_key: dagger.File) -> dagger.File:
	return (
		dag.git_actions()
		.with_repository(repo_url, ssh_key)
		.ssh_key()
	)
@func()
example(repoUrl: string, sshKey: File): File {
	return dag
		.gitActions()
		.withRepository(repoUrl, sshKey)
		.sshKey()
}

cloneSsh()

Clone Git repository using the SSH Key.

Return Type
Directory !
Example
dagger -m github.com/puzzle/dagger-module-git-actions/git-actions@ba354569d342d9ce311cadad88391048c610d584 call \
 with-repository --repo-url string --ssh-key file:path \
 clone-ssh
func (m *myModule) example(repoUrl string, sshKey *File) *Directory  {
	return dag.
			GitActions().
			WithRepository(repoUrl, sshKey).
			CloneSsh()
}
@function
def example(repo_url: str, ssh_key: dagger.File) -> dagger.Directory:
	return (
		dag.git_actions()
		.with_repository(repo_url, ssh_key)
		.clone_ssh()
	)
@func()
example(repoUrl: string, sshKey: File): Directory {
	return dag
		.gitActions()
		.withRepository(repoUrl, sshKey)
		.cloneSsh()
}

push()

Commit local changes to the Git repository using the SSH Key.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
dirDirectory !-local dir with the Git repository and the changes
prBranchString "main"Git branch to push to.
Example
dagger -m github.com/puzzle/dagger-module-git-actions/git-actions@ba354569d342d9ce311cadad88391048c610d584 call \
 with-repository --repo-url string --ssh-key file:path \
 push --dir DIR_PATH
func (m *myModule) example(ctx context.Context, repoUrl string, sshKey *File, dir *Directory)   {
	return dag.
			GitActions().
			WithRepository(repoUrl, sshKey).
			Push(ctx, dir)
}
@function
async def example(repo_url: str, ssh_key: dagger.File, dir: dagger.Directory) -> None:
	return await (
		dag.git_actions()
		.with_repository(repo_url, ssh_key)
		.push(dir)
	)
@func()
async example(repoUrl: string, sshKey: File, dir: Directory): Promise<void> {
	return dag
		.gitActions()
		.withRepository(repoUrl, sshKey)
		.push(dir)
}