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/TomChv/dagger/modules/gha@400be219f5fda2c50f9cce9bc7a48c31467e5926Entrypoint
Return Type
Gha !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobDefaults | Job | - | No description provided |
| workflowDefaults | Workflow | - | No description provided |
Example
Function Gha.Constructor is not accessible from the gha moduleFunction Gha.Constructor is not accessible from the gha moduleFunction Gha.Constructor is not accessible from the gha moduleFunction Gha.Constructor is not accessible from the gha moduleTypes
Gha 🔗
workflows() 🔗
Return Type
[Workflow ! ] ! Example
Function Gha.workflows is not accessible from the gha moduleFunction Gha.workflows is not accessible from the gha moduleFunction Gha.workflows is not accessible from the gha moduleFunction Gha.workflows is not accessible from the gha modulewithWorkflow() 🔗
Return Type
Gha !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| workflow | Workflow ! | - | No description provided |
Example
Function Gha.withWorkflow is not accessible from the gha moduleFunction Gha.withWorkflow is not accessible from the gha moduleFunction Gha.withWorkflow is not accessible from the gha moduleFunction Gha.withWorkflow is not accessible from the gha moduleworkflow() 🔗
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
Function Gha.workflow is not accessible from the gha moduleFunction Gha.workflow is not accessible from the gha moduleFunction Gha.workflow is not accessible from the gha moduleFunction Gha.workflow is not accessible from the gha modulegenerate() 🔗
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
Function Gha.generate is not accessible from the gha moduleFunction Gha.generate is not accessible from the gha moduleFunction Gha.generate is not accessible from the gha moduleFunction Gha.generate is not accessible from the gha modulejob() 🔗
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 |
| 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
Function Gha.job is not accessible from the gha moduleFunction Gha.job is not accessible from the gha moduleFunction Gha.job is not accessible from the gha moduleFunction Gha.job is not accessible from the gha moduleWorkflow 🔗
name() 🔗
Return Type
String ! Example
Function GhaWorkflow.name is not accessible from the gha moduleFunction GhaWorkflow.name is not accessible from the gha moduleFunction GhaWorkflow.name is not accessible from the gha moduleFunction GhaWorkflow.name is not accessible from the gha modulejobs() 🔗
Return Type
[Job ! ] ! Example
Function GhaWorkflow.jobs is not accessible from the gha moduleFunction GhaWorkflow.jobs is not accessible from the gha moduleFunction GhaWorkflow.jobs is not accessible from the gha moduleFunction GhaWorkflow.jobs is not accessible from the gha modulewithJob() 🔗
Return Type
Workflow !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| job | Job ! | - | No description provided |
Example
Function GhaWorkflow.withJob is not accessible from the gha moduleFunction GhaWorkflow.withJob is not accessible from the gha moduleFunction GhaWorkflow.withJob is not accessible from the gha moduleFunction GhaWorkflow.withJob is not accessible from the gha modulecheck() 🔗
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
Function GhaWorkflow.check is not accessible from the gha moduleFunction GhaWorkflow.check is not accessible from the gha moduleFunction GhaWorkflow.check is not accessible from the gha moduleFunction GhaWorkflow.check is not accessible from the gha moduleJob 🔗
name() 🔗
Return Type
String ! Example
Function GhaJob.name is not accessible from the gha moduleFunction GhaJob.name is not accessible from the gha moduleFunction GhaJob.name is not accessible from the gha moduleFunction GhaJob.name is not accessible from the gha modulecommand() 🔗
Return Type
String ! Example
Function GhaJob.command is not accessible from the gha moduleFunction GhaJob.command is not accessible from the gha moduleFunction GhaJob.command is not accessible from the gha moduleFunction GhaJob.command is not accessible from the gha modulecondition() 🔗
Make the job conditional on an expression
Return Type
String ! Example
Function GhaJob.condition is not accessible from the gha moduleFunction GhaJob.condition is not accessible from the gha moduleFunction GhaJob.condition is not accessible from the gha moduleFunction GhaJob.condition is not accessible from the gha modulesetupCommands() 🔗
Additional commands to run before the main one
Return Type
[String ! ] ! Example
Function GhaJob.setupCommands is not accessible from the gha moduleFunction GhaJob.setupCommands is not accessible from the gha moduleFunction GhaJob.setupCommands is not accessible from the gha moduleFunction GhaJob.setupCommands is not accessible from the gha moduleteardownCommands() 🔗
Additional commands to run after the main one
Return Type
[String ! ] ! Example
Function GhaJob.teardownCommands is not accessible from the gha moduleFunction GhaJob.teardownCommands is not accessible from the gha moduleFunction GhaJob.teardownCommands is not accessible from the gha moduleFunction GhaJob.teardownCommands is not accessible from the gha moduletimeoutMinutes() 🔗
The maximum number of minutes to run the workflow before killing the process
Return Type
Integer ! Example
Function GhaJob.timeoutMinutes is not accessible from the gha moduleFunction GhaJob.timeoutMinutes is not accessible from the gha moduleFunction GhaJob.timeoutMinutes is not accessible from the gha moduleFunction GhaJob.timeoutMinutes is not accessible from the gha moduledebug() 🔗
Run the workflow in debug mode
Return Type
Boolean ! Example
Function GhaJob.debug is not accessible from the gha moduleFunction GhaJob.debug is not accessible from the gha moduleFunction GhaJob.debug is not accessible from the gha moduleFunction GhaJob.debug is not accessible from the gha modulesecrets() 🔗
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
Function GhaJob.secrets is not accessible from the gha moduleFunction GhaJob.secrets is not accessible from the gha moduleFunction GhaJob.secrets is not accessible from the gha moduleFunction GhaJob.secrets is not accessible from the gha moduleenv() 🔗
Lines to append to .env. Example: [“OPENAI_API_KEY=op://CI/openai-api-key”]
Return Type
[String ! ] ! Example
Function GhaJob.env is not accessible from the gha moduleFunction GhaJob.env is not accessible from the gha moduleFunction GhaJob.env is not accessible from the gha moduleFunction GhaJob.env is not accessible from the gha modulerunner() 🔗
Dispatch jobs to the given runner Example: [“ubuntu-latest”]
Return Type
[String ! ] ! Example
Function GhaJob.runner is not accessible from the gha moduleFunction GhaJob.runner is not accessible from the gha moduleFunction GhaJob.runner is not accessible from the gha moduleFunction GhaJob.runner is not accessible from the gha modulemodule() 🔗
The Dagger module to load
Return Type
String ! Example
Function GhaJob.module is not accessible from the gha moduleFunction GhaJob.module is not accessible from the gha moduleFunction GhaJob.module is not accessible from the gha moduleFunction GhaJob.module is not accessible from the gha moduledaggerVersion() 🔗
Dagger version to run this workflow
Return Type
String ! Example
Function GhaJob.daggerVersion is not accessible from the gha moduleFunction GhaJob.daggerVersion is not accessible from the gha moduleFunction GhaJob.daggerVersion is not accessible from the gha moduleFunction GhaJob.daggerVersion is not accessible from the gha moduledaggerDev() 🔗
Build the dagger engine from scratch.
Return Type
String ! Example
Function GhaJob.daggerDev is not accessible from the gha moduleFunction GhaJob.daggerDev is not accessible from the gha moduleFunction GhaJob.daggerDev is not accessible from the gha moduleFunction GhaJob.daggerDev is not accessible from the gha modulepublicToken() 🔗
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
Function GhaJob.publicToken is not accessible from the gha moduleFunction GhaJob.publicToken is not accessible from the gha moduleFunction GhaJob.publicToken is not accessible from the gha moduleFunction GhaJob.publicToken is not accessible from the gha moduleuploadLogs() 🔗
Redirect logs to an artifact
Return Type
Boolean ! Example
Function GhaJob.uploadLogs is not accessible from the gha moduleFunction GhaJob.uploadLogs is not accessible from the gha moduleFunction GhaJob.uploadLogs is not accessible from the gha moduleFunction GhaJob.uploadLogs is not accessible from the gha modulestopEngine() 🔗
Explicitly stop the dagger engine after completing the workflow.
Return Type
Boolean ! Example
Function GhaJob.stopEngine is not accessible from the gha moduleFunction GhaJob.stopEngine is not accessible from the gha moduleFunction GhaJob.stopEngine is not accessible from the gha moduleFunction GhaJob.stopEngine is not accessible from the gha module