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/shykes/gha@v0.7.0

Entrypoint

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
noTracesBoolean -Disable sending traces to Dagger Cloud
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
daggerVersionString "latest"Dagger version to run in the Github Actions pipelines
stopEngineBoolean -Explicitly stop the Dagger Engine after completing the pipeline
asJsonBoolean -Encode all files as JSON (which is also valid YAML)
runnerString "ubuntu-latest"Configure a default runner for all workflows See https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-self-hosted-runners-in-a-workflow
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 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 🔗

onDispatch() 🔗

Add a trigger to execute a Dagger pipeline on a workflow dispatch event

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
nameString !-Pipeline name
commandString !-The Dagger command to execute Example 'build --source=.'
moduleString -Dagger module to load
secrets[String ! ] -Github secrets to inject into the pipeline environment. For each secret, an env variable with the same name is created. Example: ["PROD_DEPLOY_TOKEN", "PRIVATE_SSH_KEY"]
runnerString -Dispatch jobs to the given runner
sparseCheckout[String ! ] -Use a sparse git checkout, only including the given paths Example: ["src", "tests", "Dockerfile"]
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 call \
 on-dispatch --name string --command string
func (m *myModule) example(name string, command string) *Gha  {
	return dag.
			Gha().
			OnDispatch(name, command)
}
@function
def example(name: str, command: str) -> dag.Gha:
	return (
		dag.gha()
		.on_dispatch(name, command)
	)
@func()
example(name: string, command: string): Gha {
	return dag
		.gha()
		.onDispatch(name, command)
}

onPullRequest() 🔗

Add a trigger to execute a Dagger pipeline on a pull request

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
nameString !-Pipeline name
commandString !-The Dagger command to execute Example 'build --source=.'
moduleString -Dagger module to load
secrets[String ! ] -Github secrets to inject into the pipeline environment. For each secret, an env variable with the same name is created. Example: ["PROD_DEPLOY_TOKEN", "PRIVATE_SSH_KEY"]
branches[String ! ] -Run only for pull requests that target specific branches
types[String ! ] -Run only for certain types of pull request events See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
runnerString -Dispatch jobs to the given runner
sparseCheckout[String ! ] -Use a sparse git checkout, only including the given paths Example: ["src", "tests", "Dockerfile"]
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 call \
 on-pull-request --name string --command string
func (m *myModule) example(name string, command string) *Gha  {
	return dag.
			Gha().
			OnPullRequest(name, command)
}
@function
def example(name: str, command: str) -> dag.Gha:
	return (
		dag.gha()
		.on_pull_request(name, command)
	)
@func()
example(name: string, command: string): Gha {
	return dag
		.gha()
		.onPullRequest(name, command)
}

onPush() 🔗

Add a trigger to execute a Dagger pipeline on a git push

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
nameString !-Pipeline name
commandString !-The Dagger command to execute Example 'build --source=.'
moduleString -The Dagger module to load
secrets[String ! ] -Github secrets to inject into the pipeline environment. For each secret, an env variable with the same name is created. Example: ["PROD_DEPLOY_TOKEN", "PRIVATE_SSH_KEY"]
branches[String ! ] -Run only on push to specific branches
tags[String ! ] -Run only on push to specific branches
paths[String ! ] -Run only on push to specific paths
runnerString -Dispatch jobs to the given runner
sparseCheckout[String ! ] -Use a sparse git checkout, only including the given paths Example: ["src", "tests", "Dockerfile"]
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 call \
 on-push --name string --command string
func (m *myModule) example(name string, command string) *Gha  {
	return dag.
			Gha().
			OnPush(name, command)
}
@function
def example(name: str, command: str) -> dag.Gha:
	return (
		dag.gha()
		.on_push(name, command)
	)
@func()
example(name: string, command: string): Gha {
	return dag
		.gha()
		.onPush(name, command)
}

onIssueComment() 🔗

Add a trigger to execute a Dagger pipeline on an issue comment

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
nameString !-Pipeline name
commandString !-The Dagger command to execute Example 'build --source=.'
moduleString -The Dagger module to load
secrets[String ! ] -Github secrets to inject into the pipeline environment. For each secret, an env variable with the same name is created. Example: ["PROD_DEPLOY_TOKEN", "PRIVATE_SSH_KEY"]
runnerString -Dispatch jobs to the given runner
sparseCheckout[String ! ] -Use a sparse git checkout, only including the given paths Example: ["src", "tests", "Dockerfile"]
types[String ! ] -Run only for certain types of issue comment events See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issue_comment
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 call \
 on-issue-comment --name string --command string
func (m *myModule) example(name string, command string) *Gha  {
	return dag.
			Gha().
			OnIssueComment(name, command)
}
@function
def example(name: str, command: str) -> dag.Gha:
	return (
		dag.gha()
		.on_issue_comment(name, command)
	)
@func()
example(name: string, command: string): Gha {
	return dag
		.gha()
		.onIssueComment(name, command)
}

check() 🔗

Return Type
Gha !
Arguments
NameTypeDefault ValueDescription
repoDirectory !-No description provided
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 call \
 check --repo DIR_PATH
func (m *myModule) example(repo *Directory) *Gha  {
	return dag.
			Gha().
			Check(repo)
}
@function
def example(repo: dagger.Directory) -> dag.Gha:
	return (
		dag.gha()
		.check(repo)
	)
@func()
example(repo: Directory): Gha {
	return dag
		.gha()
		.check(repo)
}

config() 🔗

Generate a github config directory, usable as an overlay on the repository root

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
prefixString -Prefix to use for generated workflow filenames
Example
dagger -m github.com/shykes/gha@bdd9ebfa50e0f4e887de64919b43391aa112d149 call \
 config
func (m *myModule) example() *Directory  {
	return dag.
			Gha().
			Config()
}
@function
def example() -> dagger.Directory:
	return (
		dag.gha()
		.config()
	)
@func()
example(): Directory {
	return dag
		.gha()
		.config()
}