dbt-cloud-download-artifacts-action

October 27, 2024 ยท View on GitHub


dbt-cloud-download-artifacts-action

GitHub Action to download JSON artifacts from a dbt Cloud CI job triggered by a pull request.

How to use

name: CI pipeline

on:
  pull_request:
      branches:
          - main

jobs:
    download-dbt-artifacts:
        permissions:
          pull-requests: write
        runs-on: ubuntu-latest
        steps:
          - name: Download dbt artifacts
            uses: pgoslatara/dbt-cloud-download-artifacts-action@v1
            with:
              commit-sha: ${{ github.event.pull_request.head.sha }}
              dbt-cloud-api-token: ${{ secrets.DBT_CLOUD_API_TOKEN }}
              dbt-cloud-api-url-base: cloud.getdbt.com # Optional: Defaults to "cloud.getdbt.com".
              output-dir: target # Optional: Defaults to "target".
              step: 4 # Optional: Defaults to last step in CI job.
              verbose: true # Optional: Defaults to false.

          - name: Do something with the artifacts
            ...

Contributing

Set up a local development environment, requires uv:

make install

Create API tokens for both dbt Cloud and GitHub. Copy .env.example to .env and update the values.

All tests can be run with

make test