1

We are currently running a linter for each of our CI builds within GitHub PRs. This linter, though, requires a dbt manifest.json which we can only build when the full dbt schemas are available in the PR schema.

We currently need to manually re-trigger the action workflow after dbt Cloud Slim CI is finished, since we have the on trigger as follows:

on:
  pull_request:
    branches:
    - main
    types: [opened, reopened, ready_for_review, synchronize]

And, as mentioned, the manifest.json is not yet built at the moment when the PR is e.g. opened.

Is there any way that we can trigger the workflow only once the Slim CI job (that is triggered by dbt Cloud) is actually completed, and therefore the manifest.json already built?

I've come across on.check_run and on.status for Events that trigger workflows (see GH docs), but not sure whether these can be used since, as specified in the docs: "Note: This event will only trigger a workflow run if the workflow file is on the default branch."

Aleix CC
  • 1,601
  • 1
  • 7
  • 18
  • Do you have access to the dbt Cloud API? (requires a paid plan) – thedatadavis Dec 20 '22 at 06:10
  • Yes, I do have access to the API – Aleix CC Dec 20 '22 at 06:54
  • You can use a workflow that looks something like: PR triggers GH action -> Python script to trigger dbt Cloud run -> Download manifest.json -> continue checks. [Here](https://jcdan3.medium.com/how-to-run-python-scripts-in-your-github-actions-caccac969b34) is a good example of how to run a script using Actions. – thedatadavis Dec 21 '22 at 12:59
  • dbt Cloud is already running a Slim CI job based on state:modified+ .sql files on every pull request. The question was more on how to base my GH Actions workflow on that specific Slim Ci job being completed successfully. – Aleix CC Dec 21 '22 at 13:24
  • Ah, I see. There do seem to be ways to use the Check Status API (example [action](https://github.com/marketplace/actions/await-status-action)), so it looks like the short answer to your question is yes. Personally, I'd still recommend triggering the dbt job via the Cloud API (i.e. disable the webhook in the app) so that you have more control over the workflow and a linear DAG. – thedatadavis Dec 22 '22 at 05:16

0 Answers0