Skip to content

Commit 4ca22ae

Browse files
committed
Create dataform_dry_run.sh
Update .pre-commit-hooks.yaml
1 parent 73764e9 commit 4ca22ae

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@
1111
language: script
1212
files: (\.sqlx|\.js)$
1313
pass_filenames: false
14+
15+
- id: dataform_dry_run
16+
name: Dataform dry run
17+
entry: hooks/dataform_dry_run.sh
18+
language: script
19+
files: (\.sqlx|\.js)$
20+
pass_filenames: false

hooks/dataform_dry_run.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
# Check if dataform command is available, if not install it
4+
if ! command -v dataform >/dev/null 2>&1; then
5+
echo "Dataform is not installed."
6+
echo "Trying to install Dataform..."
7+
if npm i -g @dataform/cli@latest; then
8+
echo "Dataform installed successfully."
9+
else
10+
echo "Failed to install Dataform."
11+
exit 1
12+
fi
13+
fi
14+
15+
dataform install
16+
dataform run --dry-run
17+
18+
if [ $? -ne 0 ]; then
19+
exit 1
20+
else
21+
exit 0
22+
fi

0 commit comments

Comments
 (0)