Skip to content

Commit

Permalink
Fix cleanup-dbt-resources workflow to run on data-catalog branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jeancochrane committed Aug 8, 2023
1 parent 9574a38 commit a08431e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/actions/configure_dbt_environment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ runs:
steps:
- name: Configure dbt environment
run: |
if [[ $GITHUB_REF_NAME == 'master' ]]; then
# GITHUB_REF_NAME is only set on pull_request events, so if it's
# present, we must be in a PR context. Use the +x param expansion:
# https://stackoverflow.com/a/13864829
if [-z ${GITHUB_REF_NAME+x} ]; then
echo "On pull request branch, setting dbt env to CI"
{
echo "TARGET=ci";
echo "CACHE_KEY=$GITHUB_HEAD_REF";
echo "HEAD_REF=$GITHUB_HEAD_REF"
} >> "$GITHUB_ENV"
elif [[ $GITHUB_REF_NAME == 'master' ]]; then
echo "On master branch, setting dbt env to prod"
{
echo "TARGET=prod";
Expand All @@ -19,11 +29,7 @@ runs:
echo "HEAD_REF=data-catalog";
} >> "$GITHUB_ENV"
else
echo "On pull request branch, setting dbt env to CI"
{
echo "TARGET=ci";
echo "CACHE_KEY=$GITHUB_HEAD_REF";
echo "HEAD_REF=$GITHUB_HEAD_REF"
} >> "$GITHUB_ENV"
echo "CI context did not match any of the expected environments"
exit 1
fi
shell: bash

0 comments on commit a08431e

Please sign in to comment.