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
Name | Type | Default Value | Description |
---|---|---|---|
jobDefaults | Job | - | No description provided |
workflowDefaults | Workflow | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
directory | Directory | - | No description provided |
asJson | Boolean | - | No description provided |
fileExtension | String | ".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
Name | Type | Default Value | Description |
---|---|---|---|
workflow | Workflow ! | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | Workflow name |
pullRequestConcurrency | String | - | 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" |
noDispatch | Boolean | - | Disable manual "dispatch" of this workflow |
permissions | [Enum ! ] | - | Permissions to grant the workflow |
onIssueComment | Boolean | - | Run the workflow on any issue comment activity |
onIssueCommentCreated | Boolean | - | No description provided |
onIssueCommentEdited | Boolean | - | No description provided |
onIssueCommentDeleted | Boolean | - | No description provided |
onPullRequest | Boolean | - | Run the workflow on any pull request activity |
onPullRequestBranches | [String ! ] | - | No description provided |
onPullRequestPaths | [String ! ] | - | No description provided |
onPullRequestAssigned | Boolean | - | No description provided |
onPullRequestUnassigned | Boolean | - | No description provided |
onPullRequestLabeled | Boolean | - | No description provided |
onPullRequestUnlabeled | Boolean | - | No description provided |
onPullRequestOpened | Boolean | - | No description provided |
onPullRequestEdited | Boolean | - | No description provided |
onPullRequestClosed | Boolean | - | No description provided |
onPullRequestReopened | Boolean | - | No description provided |
onPullRequestSynchronize | Boolean | - | No description provided |
onPullRequestConvertedToDraft | Boolean | - | No description provided |
onPullRequestLocked | Boolean | - | No description provided |
onPullRequestUnlocked | Boolean | - | No description provided |
onPullRequestEnqueued | Boolean | - | No description provided |
onPullRequestDequeued | Boolean | - | No description provided |
onPullRequestMilestoned | Boolean | - | No description provided |
onPullRequestDemilestoned | Boolean | - | No description provided |
onPullRequestReadyForReview | Boolean | - | No description provided |
onPullRequestReviewRequested | Boolean | - | No description provided |
onPullRequestReviewRequestRemoved | Boolean | - | No description provided |
onPullRequestAutoMergeEnabled | Boolean | - | No description provided |
onPullRequestAutoMergeDisabled | Boolean | - | No description provided |
onPush | Boolean | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | No description provided |
command | String ! | - | No description provided |
publicToken | String | - | 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 |
stopEngine | Boolean | - | Explicitly stop the dagger engine after completing the workflow. |
timeoutMinutes | Integer | - | The maximum number of minutes to run the workflow before killing the process |
debug | Boolean | - | Run the workflow in debug mode |
sparseCheckout | [String ! ] | - | Use a sparse git checkout, only including the given paths Example: ["src", "tests", "Dockerfile"] |
lfs | Boolean | - | 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"] |
module | String | - | The Dagger module to load |
daggerVersion | String | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
job | Job ! | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
repo | Directory | - | 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()
}