-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.59 KB
/
dbt.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
env:
ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
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
dbt clean
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Update files from DBT run"
git push https://x-access-token:${{ secrets.ACTIONS_PAT }}@github.com/${{ github.repository }}.git main
else
echo "No changes to commit"
fi