Dagger
Search

gha

Daggerizing your CI makes your YAML configurations smaller, but they still exist,
and they're still a pain to maintain by hand.

This module aims to finish the job, by letting you generate your remaining
YAML configuration from a Dagger pipeline, written in your favorite language.

Installation

dagger install github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf

Entrypoint

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
jobDefaultsJob -No description provided
workflowDefaultsWorkflow -No description provided
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
func (m *myModule) example() *Gha  {
	return dag.
			Gha()
}
@function
def example() -> dag.Gha:
	return (
		dag.gha()
	)
@func()
example(): Gha {
	return dag
		.gha()
}

Types

Gha 🔗

workflows() 🔗

Return Type
[Workflow ! ] !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 workflows
func (m *myModule) example() []*GhaWorkflow  {
	return dag.
			Gha().
			Workflows()
}
@function
def example() -> List[dag.GhaWorkflow]:
	return (
		dag.gha()
		.workflows()
	)
@func()
example(): GhaWorkflow[] {
	return dag
		.gha()
		.workflows()
}

generate() 🔗

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
directoryDirectory -No description provided
asJsonBoolean -No description provided
fileExtensionString ".gen.yml"No description provided
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 generate
func (m *myModule) example() *Directory  {
	return dag.
			Gha().
			Generate()
}
@function
def example() -> dagger.Directory:
	return (
		dag.gha()
		.generate()
	)
@func()
example(): Directory {
	return dag
		.gha()
		.generate()
}

withWorkflow() 🔗

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
workflowWorkflow !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *myModule) example(workflow *GhaWorkflow) *Gha  {
	return dag.
			Gha().
			WithWorkflow(workflow)
}
@function
def example(workflow: dag.GhaWorkflow) -> dag.Gha:
	return (
		dag.gha()
		.with_workflow(workflow)
	)
@func()
example(workflow: GhaWorkflow): Gha {
	return dag
		.gha()
		.withWorkflow(workflow)
}

workflow() 🔗

Add a workflow

Return Type
Workflow !
Arguments
NameTypeDefault ValueDescription
nameString !-Workflow name
pullRequestConcurrencyString -Configure this workflow's concurrency for each PR. This is triggered when the workflow is scheduled concurrently on the same PR. - allow: all instances are allowed to run concurrently - queue: new instances are queued, and run sequentially - preempt: new instances run immediately, older ones are canceled Possible values: "allow", "preempt", "queue"
noDispatchBoolean -Disable manual "dispatch" of this workflow
permissions[Enum ! ] -Permissions to grant the workflow
onIssueCommentBoolean -Run the workflow on any issue comment activity
onIssueCommentCreatedBoolean -No description provided
onIssueCommentEditedBoolean -No description provided
onIssueCommentDeletedBoolean -No description provided
onPullRequestBoolean -Run the workflow on any pull request activity
onPullRequestBranches[String ! ] -No description provided
onPullRequestPaths[String ! ] -No description provided
onPullRequestAssignedBoolean -No description provided
onPullRequestUnassignedBoolean -No description provided
onPullRequestLabeledBoolean -No description provided
onPullRequestUnlabeledBoolean -No description provided
onPullRequestOpenedBoolean -No description provided
onPullRequestEditedBoolean -No description provided
onPullRequestClosedBoolean -No description provided
onPullRequestReopenedBoolean -No description provided
onPullRequestSynchronizeBoolean -No description provided
onPullRequestConvertedToDraftBoolean -No description provided
onPullRequestLockedBoolean -No description provided
onPullRequestUnlockedBoolean -No description provided
onPullRequestEnqueuedBoolean -No description provided
onPullRequestDequeuedBoolean -No description provided
onPullRequestMilestonedBoolean -No description provided
onPullRequestDemilestonedBoolean -No description provided
onPullRequestReadyForReviewBoolean -No description provided
onPullRequestReviewRequestedBoolean -No description provided
onPullRequestReviewRequestRemovedBoolean -No description provided
onPullRequestAutoMergeEnabledBoolean -No description provided
onPullRequestAutoMergeDisabledBoolean -No description provided
onPushBoolean -Run the workflow on any git push
onPushTags[String ! ] -Run the workflow on git push to the specified tags
onPushBranches[String ! ] -Run the workflow on git push to the specified branches
onSchedule[String ! ] -Run the workflow at a schedule time
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 workflow --name string
func (m *myModule) example(name string) *GhaWorkflow  {
	return dag.
			Gha().
			Workflow(name)
}
@function
def example(name: str) -> dag.GhaWorkflow:
	return (
		dag.gha()
		.workflow(name)
	)
@func()
example(name: string): GhaWorkflow {
	return dag
		.gha()
		.workflow(name)
}

job() 🔗

Return Type
Job !
Arguments
NameTypeDefault ValueDescription
nameString !-No description provided
commandString !-No description provided
publicTokenString -Public Dagger Cloud token, for open-source projects. DO NOT PASS YOUR PRIVATE DAGGER CLOUD TOKEN! This is for a special "public" token which can safely be shared publicly. To get one, contact support@dagger.io
stopEngineBoolean -Explicitly stop the dagger engine after completing the workflow.
timeoutMinutesInteger -The maximum number of minutes to run the workflow before killing the process
debugBoolean -Run the workflow in debug mode
sparseCheckout[String ! ] -Use a sparse git checkout, only including the given paths Example: ["src", "tests", "Dockerfile"]
lfsBoolean -Enable lfs on git checkout
secrets[String ! ] -Github secrets to inject into the workflow environment. For each secret, an env variable with the same name is created. Example: ["PROD_DEPLOY_TOKEN", "PRIVATE_SSH_KEY"]
runner[String ! ] -Dispatch jobs to the given runner Example: ["ubuntu-latest"]
moduleString -The Dagger module to load
daggerVersionString -Dagger version to run this workflow
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string
func (m *myModule) example(name string, command string) *GhaJob  {
	return dag.
			Gha().
			Job(name, command)
}
@function
def example(name: str, command: str) -> dag.GhaJob:
	return (
		dag.gha()
		.job(name, command)
	)
@func()
example(name: string, command: string): GhaJob {
	return dag
		.gha()
		.job(name, command)
}

Workflow 🔗

name() 🔗

Return Type
String !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 workflow --name string \
 name
func (m *myModule) example(ctx context.Context, name string) string  {
	return dag.
			Gha().
			Workflow(name).
			Name(ctx)
}
@function
async def example(name: str) -> str:
	return await (
		dag.gha()
		.workflow(name)
		.name()
	)
@func()
async example(name: string): Promise<string> {
	return dag
		.gha()
		.workflow(name)
		.name()
}

jobs() 🔗

Return Type
[Job ! ] !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 workflow --name string \
 jobs
func (m *myModule) example(name string) []*GhaJob  {
	return dag.
			Gha().
			Workflow(name).
			Jobs()
}
@function
def example(name: str) -> List[dag.GhaJob]:
	return (
		dag.gha()
		.workflow(name)
		.jobs()
	)
@func()
example(name: string): GhaJob[] {
	return dag
		.gha()
		.workflow(name)
		.jobs()
}

withJob() 🔗

Return Type
Workflow !
Arguments
NameTypeDefault ValueDescription
jobJob !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *myModule) example(name string, job *GhaJob) *GhaWorkflow  {
	return dag.
			Gha().
			Workflow(name).
			WithJob(job)
}
@function
def example(name: str, job: dag.GhaJob) -> dag.GhaWorkflow:
	return (
		dag.gha()
		.workflow(name)
		.with_job(job)
	)
@func()
example(name: string, job: GhaJob): GhaWorkflow {
	return dag
		.gha()
		.workflow(name)
		.withJob(job)
}

check() 🔗

Check that the workflow is valid, in a best effort way

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
repoDirectory -No description provided
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 workflow --name string \
 check
func (m *myModule) example(ctx context.Context, name string)   {
	return dag.
			Gha().
			Workflow(name).
			Check(ctx)
}
@function
async def example(name: str) -> None:
	return await (
		dag.gha()
		.workflow(name)
		.check()
	)
@func()
async example(name: string): Promise<void> {
	return dag
		.gha()
		.workflow(name)
		.check()
}

Job 🔗

name() 🔗

Return Type
String !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 name
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			Name(ctx)
}
@function
async def example(name: str, command: str) -> str:
	return await (
		dag.gha()
		.job(name, command)
		.name()
	)
@func()
async example(name: string, command: string): Promise<string> {
	return dag
		.gha()
		.job(name, command)
		.name()
}

command() 🔗

Return Type
String !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 command
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			Command(ctx)
}
@function
async def example(name: str, command: str) -> str:
	return await (
		dag.gha()
		.job(name, command)
		.command()
	)
@func()
async example(name: string, command: string): Promise<string> {
	return dag
		.gha()
		.job(name, command)
		.command()
}

timeoutMinutes() 🔗

The maximum number of minutes to run the workflow before killing the process

Return Type
Integer !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 timeout-minutes
func (m *myModule) example(ctx context.Context, name string, command string) int  {
	return dag.
			Gha().
			Job(name, command).
			TimeoutMinutes(ctx)
}
@function
async def example(name: str, command: str) -> int:
	return await (
		dag.gha()
		.job(name, command)
		.timeout_minutes()
	)
@func()
async example(name: string, command: string): Promise<number> {
	return dag
		.gha()
		.job(name, command)
		.timeoutMinutes()
}

debug() 🔗

Run the workflow in debug mode

Return Type
Boolean !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 debug
func (m *myModule) example(ctx context.Context, name string, command string) bool  {
	return dag.
			Gha().
			Job(name, command).
			Debug(ctx)
}
@function
async def example(name: str, command: str) -> bool:
	return await (
		dag.gha()
		.job(name, command)
		.debug()
	)
@func()
async example(name: string, command: string): Promise<boolean> {
	return dag
		.gha()
		.job(name, command)
		.debug()
}

sparseCheckout() 🔗

Use a sparse git checkout, only including the given paths Example: [“src”, “tests”, “Dockerfile”]

Return Type
[String ! ] !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 sparse-checkout
func (m *myModule) example(ctx context.Context, name string, command string) []string  {
	return dag.
			Gha().
			Job(name, command).
			SparseCheckout(ctx)
}
@function
async def example(name: str, command: str) -> List[str]:
	return await (
		dag.gha()
		.job(name, command)
		.sparse_checkout()
	)
@func()
async example(name: string, command: string): Promise<string[]> {
	return dag
		.gha()
		.job(name, command)
		.sparseCheckout()
}

lfs() 🔗

Enable lfs on git checkout

Return Type
Boolean !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 lfs
func (m *myModule) example(ctx context.Context, name string, command string) bool  {
	return dag.
			Gha().
			Job(name, command).
			Lfs(ctx)
}
@function
async def example(name: str, command: str) -> bool:
	return await (
		dag.gha()
		.job(name, command)
		.lfs()
	)
@func()
async example(name: string, command: string): Promise<boolean> {
	return dag
		.gha()
		.job(name, command)
		.lfs()
}

secrets() 🔗

Github secrets to inject into the workflow environment. For each secret, an env variable with the same name is created. Example: [“PROD_DEPLOY_TOKEN”, “PRIVATE_SSH_KEY”]

Return Type
[String ! ] !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 secrets
func (m *myModule) example(ctx context.Context, name string, command string) []string  {
	return dag.
			Gha().
			Job(name, command).
			Secrets(ctx)
}
@function
async def example(name: str, command: str) -> List[str]:
	return await (
		dag.gha()
		.job(name, command)
		.secrets()
	)
@func()
async example(name: string, command: string): Promise<string[]> {
	return dag
		.gha()
		.job(name, command)
		.secrets()
}

runner() 🔗

Dispatch jobs to the given runner Example: [“ubuntu-latest”]

Return Type
[String ! ] !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 runner
func (m *myModule) example(ctx context.Context, name string, command string) []string  {
	return dag.
			Gha().
			Job(name, command).
			Runner(ctx)
}
@function
async def example(name: str, command: str) -> List[str]:
	return await (
		dag.gha()
		.job(name, command)
		.runner()
	)
@func()
async example(name: string, command: string): Promise<string[]> {
	return dag
		.gha()
		.job(name, command)
		.runner()
}

module() 🔗

The Dagger module to load

Return Type
String !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 module
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			Module(ctx)
}
@function
async def example(name: str, command: str) -> str:
	return await (
		dag.gha()
		.job(name, command)
		.module()
	)
@func()
async example(name: string, command: string): Promise<string> {
	return dag
		.gha()
		.job(name, command)
		.module()
}

daggerVersion() 🔗

Dagger version to run this workflow

Return Type
String !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 dagger-version
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			DaggerVersion(ctx)
}
@function
async def example(name: str, command: str) -> str:
	return await (
		dag.gha()
		.job(name, command)
		.dagger_version()
	)
@func()
async example(name: string, command: string): Promise<string> {
	return dag
		.gha()
		.job(name, command)
		.daggerVersion()
}

publicToken() 🔗

Public Dagger Cloud token, for open-source projects. DO NOT PASS YOUR PRIVATE DAGGER CLOUD TOKEN! This is for a special “public” token which can safely be shared publicly. To get one, contact support@dagger.io

Return Type
String !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 public-token
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			PublicToken(ctx)
}
@function
async def example(name: str, command: str) -> str:
	return await (
		dag.gha()
		.job(name, command)
		.public_token()
	)
@func()
async example(name: string, command: string): Promise<string> {
	return dag
		.gha()
		.job(name, command)
		.publicToken()
}

stopEngine() 🔗

Explicitly stop the dagger engine after completing the workflow.

Return Type
Boolean !
Example
dagger -m github.com/dagger/dagger/modules/gha@67f198381a874c35362cb3424dd27aafe15d94cf call \
 job --name string --command string \
 stop-engine
func (m *myModule) example(ctx context.Context, name string, command string) bool  {
	return dag.
			Gha().
			Job(name, command).
			StopEngine(ctx)
}
@function
async def example(name: str, command: str) -> bool:
	return await (
		dag.gha()
		.job(name, command)
		.stop_engine()
	)
@func()
async example(name: string, command: string): Promise<boolean> {
	return dag
		.gha()
		.job(name, command)
		.stopEngine()
}