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/jedevc/dagger/modules/gha@da43efc564697910d28e5a4e5c11072e44d9f439

Entrypoint

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
jobDefaultsJob -No description provided
workflowDefaultsWorkflow -No description provided
Example
func (m *myModule) example() *Gha  {
	return dag.
			Gha()
}

Types

Gha ๐Ÿ”—

workflows() ๐Ÿ”—

Return Type
[Workflow ! ] !
Example
func (m *myModule) example() []*GhaWorkflow  {
	return dag.
			Gha().
			Workflows()
}

withWorkflow() ๐Ÿ”—

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
workflowWorkflow !-No description provided
Example
func (m *myModule) 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
func (m *myModule) example(name string) *GhaWorkflow  {
	return dag.
			Gha().
			Workflow(name)
}

generate() ๐Ÿ”—

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
directoryDirectory -No description provided
asJsonBoolean -No description provided
fileExtensionString ".gen.yml"No description provided
Example
func (m *myModule) example() *Directory  {
	return dag.
			Gha().
			Generate()
}

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
func (m *myModule) example(name string, command string) *GhaJob  {
	return dag.
			Gha().
			Job(name, command)
}

Workflow ๐Ÿ”—

name() ๐Ÿ”—

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string) string  {
	return dag.
			Gha().
			Workflow(name).
			Name(ctx)
}

jobs() ๐Ÿ”—

Return Type
[Job ! ] !
Example
func (m *myModule) example(name string) []*GhaJob  {
	return dag.
			Gha().
			Workflow(name).
			Jobs()
}

withJob() ๐Ÿ”—

Return Type
Workflow !
Arguments
NameTypeDefault ValueDescription
jobJob !-No description provided
Example
func (m *myModule) 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
func (m *myModule) example(ctx context.Context, name string)   {
	return dag.
			Gha().
			Workflow(name).
			Check(ctx)
}

Job ๐Ÿ”—

name() ๐Ÿ”—

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			Name(ctx)
}

command() ๐Ÿ”—

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			Command(ctx)
}

timeoutMinutes() ๐Ÿ”—

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

Return Type
Integer !
Example
func (m *myModule) example(ctx context.Context, name string, command string) int  {
	return dag.
			Gha().
			Job(name, command).
			TimeoutMinutes(ctx)
}

debug() ๐Ÿ”—

Run the workflow in debug mode

Return Type
Boolean !
Example
func (m *myModule) example(ctx context.Context, name string, command string) bool  {
	return dag.
			Gha().
			Job(name, command).
			Debug(ctx)
}

sparseCheckout() ๐Ÿ”—

Use a sparse git checkout, only including the given paths Example: [โ€œsrcโ€, โ€œtestsโ€, โ€œDockerfileโ€]

Return Type
[String ! ] !
Example
func (m *myModule) example(ctx context.Context, name string, command string) []string  {
	return dag.
			Gha().
			Job(name, command).
			SparseCheckout(ctx)
}

lfs() ๐Ÿ”—

Enable lfs on git checkout

Return Type
Boolean !
Example
func (m *myModule) example(ctx context.Context, name string, command string) bool  {
	return dag.
			Gha().
			Job(name, command).
			Lfs(ctx)
}

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
func (m *myModule) example(ctx context.Context, name string, command string) []string  {
	return dag.
			Gha().
			Job(name, command).
			Secrets(ctx)
}

runner() ๐Ÿ”—

Dispatch jobs to the given runner Example: [โ€œubuntu-latestโ€]

Return Type
[String ! ] !
Example
func (m *myModule) example(ctx context.Context, name string, command string) []string  {
	return dag.
			Gha().
			Job(name, command).
			Runner(ctx)
}

module() ๐Ÿ”—

The Dagger module to load

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			Module(ctx)
}

daggerVersion() ๐Ÿ”—

Dagger version to run this workflow

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			DaggerVersion(ctx)
}

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
func (m *myModule) example(ctx context.Context, name string, command string) string  {
	return dag.
			Gha().
			Job(name, command).
			PublicToken(ctx)
}

stopEngine() ๐Ÿ”—

Explicitly stop the dagger engine after completing the workflow.

Return Type
Boolean !
Example
func (m *myModule) example(ctx context.Context, name string, command string) bool  {
	return dag.
			Gha().
			Job(name, command).
			StopEngine(ctx)
}