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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dcEntrypoint
Return Type
Gha !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobDefaults | Job | - | No description provided |
| workflowDefaults | Workflow | - | No description provided |
Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
func (m *MyModule) Example() *dagger.Gha {
return dag.
Gha()
}@function
def example() -> dagger.Gha:
return (
dag.gha()
)@func()
example(): Gha {
return dag
.gha()
}Types
Gha 🔗
workflows() 🔗
Return Type
[Workflow ! ] ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
workflowsfunc (m *MyModule) Example() []*dagger.GhaWorkflow {
return dag.
Gha().
Workflows()
}@function
def example() -> List[dagger.GhaWorkflow]:
return (
dag.gha()
.workflows()
)@func()
example(): GhaWorkflow[] {
return dag
.gha()
.workflows()
}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 *dagger.GhaWorkflow) *dagger.Gha {
return dag.
Gha().
WithWorkflow(workflow)
}@function
def example(workflow: dagger.GhaWorkflow) -> dagger.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 |
| onPushPaths | [String ! ] | - | Run the workflow only if the paths match |
| onSchedule | [String ! ] | - | Run the workflow at a schedule time |
Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
workflow --name stringfunc (m *MyModule) Example(name string) *dagger.GhaWorkflow {
return dag.
Gha().
Workflow(name)
}@function
def example(name: str) -> dagger.GhaWorkflow:
return (
dag.gha()
.workflow(name)
)@func()
example(name: string): GhaWorkflow {
return dag
.gha()
.workflow(name)
}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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
generatefunc (m *MyModule) Example() *dagger.Directory {
return dag.
Gha().
Generate()
}@function
def example() -> dagger.Directory:
return (
dag.gha()
.generate()
)@func()
example(): Directory {
return dag
.gha()
.generate()
}job() 🔗
Return Type
Job !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| command | String ! | - | No description provided |
| condition | String | - | Only run the job if this condition expression succeeds. |
| setupCommands | [String ! ] | - | Additional commands to run before the main one. |
| teardownCommands | [String ! ] | - | Additional commands to run after the main one. |
| 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"] |
| env | [String ! ] | - | Dagger secret URIs to load and assign as env variables. Example: ["OPENAI_API_KEY=op://CI/openai-api-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 |
| daggerDev | String | - | Dagger dev version to run this workflow. |
| uploadLogs | Boolean | - | Redirect logs to an artifact |
Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command stringfunc (m *MyModule) Example(name string, command string) *dagger.GhaJob {
return dag.
Gha().
Job(name, command)
}@function
def example(name: str, command: str) -> dagger.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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
workflow --name string \
namefunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
workflow --name string \
jobsfunc (m *MyModule) Example(name string) []*dagger.GhaJob {
return dag.
Gha().
Workflow(name).
Jobs()
}@function
def example(name: str) -> List[dagger.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 *dagger.GhaJob) *dagger.GhaWorkflow {
return dag.
Gha().
Workflow(name).
WithJob(job)
}@function
def example(name: str, job: dagger.GhaJob) -> dagger.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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
workflow --name string \
checkfunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
namefunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
commandfunc (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()
}condition() 🔗
Make the job conditional on an expression
Return Type
String ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
conditionfunc (m *MyModule) Example(ctx context.Context, name string, command string) string {
return dag.
Gha().
Job(name, command).
Condition(ctx)
}@function
async def example(name: str, command: str) -> str:
return await (
dag.gha()
.job(name, command)
.condition()
)@func()
async example(name: string, command: string): Promise<string> {
return dag
.gha()
.job(name, command)
.condition()
}setupCommands() 🔗
Additional commands to run before the main one
Return Type
[String ! ] ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
setup-commandsfunc (m *MyModule) Example(ctx context.Context, name string, command string) []string {
return dag.
Gha().
Job(name, command).
SetupCommands(ctx)
}@function
async def example(name: str, command: str) -> List[str]:
return await (
dag.gha()
.job(name, command)
.setup_commands()
)@func()
async example(name: string, command: string): Promise<string[]> {
return dag
.gha()
.job(name, command)
.setupCommands()
}teardownCommands() 🔗
Additional commands to run after the main one
Return Type
[String ! ] ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
teardown-commandsfunc (m *MyModule) Example(ctx context.Context, name string, command string) []string {
return dag.
Gha().
Job(name, command).
TeardownCommands(ctx)
}@function
async def example(name: str, command: str) -> List[str]:
return await (
dag.gha()
.job(name, command)
.teardown_commands()
)@func()
async example(name: string, command: string): Promise<string[]> {
return dag
.gha()
.job(name, command)
.teardownCommands()
}timeoutMinutes() 🔗
The maximum number of minutes to run the workflow before killing the process
Return Type
Integer ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
timeout-minutesfunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
debugfunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
sparse-checkoutfunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
lfsfunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
secretsfunc (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()
}env() 🔗
Lines to append to .env. Example: [“OPENAI_API_KEY=op://CI/openai-api-key”]
Return Type
[String ! ] ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
envfunc (m *MyModule) Example(ctx context.Context, name string, command string) []string {
return dag.
Gha().
Job(name, command).
Env(ctx)
}@function
async def example(name: str, command: str) -> List[str]:
return await (
dag.gha()
.job(name, command)
.env()
)@func()
async example(name: string, command: string): Promise<string[]> {
return dag
.gha()
.job(name, command)
.env()
}runner() 🔗
Dispatch jobs to the given runner Example: [“ubuntu-latest”]
Return Type
[String ! ] ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
runnerfunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
modulefunc (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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
dagger-versionfunc (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()
}daggerDev() 🔗
Build the dagger engine from scratch.
Return Type
String ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
dagger-devfunc (m *MyModule) Example(ctx context.Context, name string, command string) string {
return dag.
Gha().
Job(name, command).
DaggerDev(ctx)
}@function
async def example(name: str, command: str) -> str:
return await (
dag.gha()
.job(name, command)
.dagger_dev()
)@func()
async example(name: string, command: string): Promise<string> {
return dag
.gha()
.job(name, command)
.daggerDev()
}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/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
public-tokenfunc (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()
}uploadLogs() 🔗
Redirect logs to an artifact
Return Type
Boolean ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
upload-logsfunc (m *MyModule) Example(ctx context.Context, name string, command string) bool {
return dag.
Gha().
Job(name, command).
UploadLogs(ctx)
}@function
async def example(name: str, command: str) -> bool:
return await (
dag.gha()
.job(name, command)
.upload_logs()
)@func()
async example(name: string, command: string): Promise<boolean> {
return dag
.gha()
.job(name, command)
.uploadLogs()
}stopEngine() 🔗
Explicitly stop the dagger engine after completing the workflow.
Return Type
Boolean ! Example
dagger -m github.com/AmirulAndalib/dagger/modules/gha@997d9f7def31513953476de13b165f362d6a40dc call \
job --name string --command string \
stop-enginefunc (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()
}