Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
/ ci-basic-action Public archive

A GitHub Action to run dbt and dbt-coves commands in a Docker container.

License

Notifications You must be signed in to change notification settings

datacoves/ci-basic-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ci-basic-action

A GitHub Action to run dbt <= 1.1.1 and dbt-coves commands in a Docker container. You can use dbt commands such as run, test and debug. This action captures the dbt console output for use in subsequent steps.

Supported versions

Library Version
dbt 1.1.1
dbt-coves 1.1.1a1

Usage

    - name: ci-basic-action
      uses: datacoves/ci-basic-action@master
      with:
        command: "dbt run --profiles-dir ."
      env:
        DBT_USER: ${{ secrets.DBT_USER }}
        DBT_PASSWORD: ${{ secrets.DBT_PASSWORD }}

Outputs

The result of the dbt command is either failed or passed and is saved into the result output if you want to use it in a next step:

    - name: ci-basic-action
      id: dbt-run
      uses: datacoves/ci-basic-action@master
      with:
        command: "dbt run --profiles-dir ."
      env:
        DBT_USER: ${{ secrets.DBT_USER }}
        DBT_PASSWORD: ${{ secrets.DBT_PASSWORD }}
    - name: Get the result
      if: ${{ always() }}
      run: echo "${{ steps.dbt-run.outputs.result }}"
      shell: bash

The result output is also saved in the DBT_RUN_STATE environment variable. The location of the dbt console log output can be accessed via the environment variable DBT_LOG_PATH. See the "Suggested workflow" section on how to use these.

General Setup

This action assumes that your dbt project is in the top-level directory of your repo, such as this sample dbt project. If your dbt project files are in a folder, you can specify it as such:

    - name: ci-basic-action
      uses: datacoves/ci-basic-action@master
      with:
        command: "dbt run --profiles-dir ."
        project_folder: "dbt_project"
      env:
        DBT_USER: ${{ secrets.DBT_USER }}
        DBT_PASSWORD: ${{ secrets.DBT_PASSWORD }}

Important: dbt projects use a profiles.yml file to connect to your dataset. ci-basic-action currently requires .config/profiles.yml to be in your repo unless changed using the --profiles-dir argument or the DBT_PROFILES_DIR environment variable.

Thanks

This repo was inspired on https://github.com/mwhitaker/dbt-action. Thanks to Michael Whitaker.

Suggested workflow and other tips

Here is a sample workflow that sends dbt console logs by email.

License

MIT

About

A GitHub Action to run dbt and dbt-coves commands in a Docker container.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •