I currently have a YAML file set up. At the moment, it allows one Databricks notebook to run upon a successful push to GitHub branch.
However, I haven’t been able to configure it to handle multiple Databricks notebooks during a single merge.
Here is my YAML file:
name: run-sql-notebooks
on:
push:
branches:
- dev
env:
DATABRICKS_HOST: https://mydatabricks.cloud.databricks.com
DATABRICKS_CLUSTER_ID: 1255-122012-pwryxyz1
DEV: dev
jobs:
run_sql_notebooks:
name: Run updated SQL notebooks
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find modified SQL notebooks in last commit
id: changed_sqls
run: |
NOTEBOOKS=$(git diff --name-only HEAD^ HEAD | grep '\.sql$' || true)
echo "notebooks<<EOF" >> $GITHUB_OUTPUT
echo "$NOTEBOOKS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Run modified SQL notebooks on Databricks
if: steps.changed_sqls.outputs.notebooks != ''
uses: databricks/run-notebook@v0
with:
run-name: "GitHub Actions - ${{ github.run_number }}"
local-notebook-path: ${{ steps.changed_sqls.outputs.notebooks }}
git-commit: ${{ github.sha }}
existing-cluster-id: ${{ env.DATABRICKS_CLUSTER_ID }}
notebook-params-json: |
{
"env": "${{ env.DEV }}"
}
env:
DATABRICKS_HOST: ${{ env.DATABRICKS_HOST }}
DATABRICKS_TOKEN: ${{ secrets.DB_SECRET }}```