Skip to content

Commit c208087

Browse files
fix: address CodeRabbit review comments
- Pin dbt-core and adapter versions to >=1.8,<1.10 - Validate max-age-hours input is a non-negative integer - Fail fast when CI_WAREHOUSE_SECRETS secret is missing Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent 225a5fb commit c208087

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/cleanup-stale-schemas.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ jobs:
4545
- name: Install dbt
4646
run: >
4747
pip install
48-
"dbt-core"
49-
"dbt-${{ (matrix.warehouse-type == 'databricks_catalog' && 'databricks') || (matrix.warehouse-type == 'athena' && 'athena-community') || matrix.warehouse-type }}"
48+
"dbt-core>=1.8,<1.10"
49+
"dbt-${{ (matrix.warehouse-type == 'databricks_catalog' && 'databricks') || (matrix.warehouse-type == 'athena' && 'athena-community') || matrix.warehouse-type }}>=1.8,<1.10"
5050
5151
- name: Write dbt profiles
5252
env:
5353
CI_WAREHOUSE_SECRETS: ${{ secrets.CI_WAREHOUSE_SECRETS || '' }}
5454
run: |
55+
if [ -z "$CI_WAREHOUSE_SECRETS" ]; then
56+
echo "::error::Missing required secret: CI_WAREHOUSE_SECRETS"
57+
exit 1
58+
fi
5559
# The cleanup job doesn't create schemas, but generate_profiles.py
5660
# requires --schema-name. Use a dummy value.
5761
python "${{ github.workspace }}/dbt-data-reliability/integration_tests/profiles/generate_profiles.py" \
@@ -68,7 +72,14 @@ jobs:
6872

6973
- name: Drop stale CI schemas
7074
working-directory: ${{ env.TESTS_DIR }}/dbt_project
71-
run: >
72-
dbt run-operation drop_stale_ci_schemas
73-
--args '{prefixes: ["py_"], max_age_hours: ${{ inputs.max-age-hours || '24' }}}'
74-
-t "${{ matrix.warehouse-type }}"
75+
env:
76+
MAX_AGE_HOURS: ${{ inputs.max-age-hours || '24' }}
77+
run: |
78+
if ! [[ "$MAX_AGE_HOURS" =~ ^[0-9]+$ ]]; then
79+
echo "::error::max-age-hours must be a non-negative integer"
80+
exit 1
81+
fi
82+
ARGS=$(printf '{"prefixes":["py_"],"max_age_hours":%s}' "$MAX_AGE_HOURS")
83+
dbt run-operation drop_stale_ci_schemas \
84+
--args "$ARGS" \
85+
-t "${{ matrix.warehouse-type }}"

0 commit comments

Comments
 (0)