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
Name | Type | Default Value | Description |
---|---|---|---|
jobDefaults | Job | - | No description provided |
workflowDefaults | Workflow | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
workflow | Workflow ! | - | No description provided |
Example
func (m *myModule) 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
func (m *myModule) 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
func (m *myModule) 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 |
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
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
Name | Type | Default Value | Description |
---|---|---|---|
job | Job ! | - | 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
Name | Type | Default Value | Description |
---|---|---|---|
repo | Directory | - | 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)
}