Run DBT Project #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run DBT Project | ||
on: | ||
schedule: | ||
- cron: '0 6 * * *' # 6 AM UTC | ||
- cron: '0 14 * * *' # 2 PM UTC | ||
- cron: '0 22 * * *' # 10 PM UTC | ||
workflow_dispatch: # Allows for manual triggering of the workflow | ||
jobs: | ||
run-dbt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.12' # Adjust the Python version as needed | ||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
sudo apt-get install git | ||
- name: Run DBT | ||
run: | | ||
cd petro_dbt | ||
dbt deps | ||
dbt run | ||
- name: Check for changes | ||
run: git status | ||
- name: Configure git | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Commit and push changes | ||
run: | | ||
git add files/* | ||
git commit -m "Update files from DBT run" | ||
git push https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}.git main | ||
if: | | ||
Check failure on line 56 in .github/workflows/dbt.yaml GitHub Actions / Run DBT ProjectInvalid workflow file
|
||
git diff --quiet || echo "Changes detected" | ||