Dart Github Actions

dart_github_actions codecov style: very good analysis License: MIT

A project for writing Github Workflows using a type-safe api rather than yaml.

This project is heavily inspired by github-actions-kotlin-dsl, but aims to fill in some of the gaps with kotlin scripting. This project is by no means a replacement, rather, it is an alternative.

Version 0.X

Dart Github Actions is still in development with basic functionality implemented to start writing and generating workflows. While in the 0.x version range, the API is subject to change while more of the Github Workflow syntax is implemented.

Be sure to submit an issue or start a discussion for any bugs or feature requests.

Feature List

General syntax

  • Workflow
    • Worfklow Concurrency
    • Workflow Permissions
    • Workflow Environment Variables
  • Jobs
    • X Job Outputs
    • X Job Defaults
    • Job Concurrency
    • Job Strategy
    • Action Step
    • Command Step
    • Job Conditionals
    • Job Environment Variables
    • Job Container
    • Job Services


  • branch_protection_rule
  • check_run
  • check_suite
  • create
  • delete
  • deployment
  • deployment_status
  • discussion
  • discussion_comment
  • fork
  • gollum
  • issue_comment
  • issues
  • label
  • merge_group
  • milestone
  • page_build
  • project
  • project_card
  • project_column
  • public
  • X pull_request
  • pull_request_comment (use issue_comment)
  • pull_request_review
  • pull_request_review_comment
  • pull_request_target
  • X push
  • registry_package
  • release
  • repository_dispatch
  • schedule
  • status
  • watch
  • workflow_call
  • workflow_dispatch
  • workflow_run


  1. Create a pubspec.yaml file in your .github folder of your project with dart_github_actions as a dependency.

NOTE: Currently the best way to setup your project to utilize dart_github_actions is to place the pubspec.yaml file in your .github folder and then open that folder in a new window of Visual Studio Code for the best IDE experience. I have found opening the root folder causes issues with the IDE auto completion and erorr recognition.

# .github/pubspec.yaml
name: workflows
description: Project for dart_github_actions defined workflows.
version: 1.0.0+1
publish_to: none

  sdk: ">=2.17.0 <3.0.0"

  dart_github_actions: latest
  1. Run dart pub get.

Writing Workflows

  1. Create a dart file for your workflow. Your file should contain an async main() method.
// .github/workflows/workflow.dart
import 'package:dart_github_actions/dart_github_actions.dart';

void main() async {
  await Workflow(
    name: 'workflow',
    on: [
        branches: ['master'],
    jobs: [
        id: 'job-1',
        runsOn: RunnerType.ubuntuLatest,
        ..run('echo step 1', name: 'Step 1')
        ..run('echo step 2', name: 'Step 1'),
  1. Run your file with dart workflow.dart and the following should be produced:
# This workflow has been generated using dart_github_actions (https://github.com/scottbisaillon/dart_github_actions).
# All modifications should be made to 'workflow.dart' and the workflow regenerated.

name: workflow
      - master
    runs-on: ubuntu-latest
        id: step-0
        name: Step 1
        run: echo step 1
        id: step-1
        name: Step 1
        run: echo step 2