Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Brave Okafor committed Sep 24, 2023
1 parent e4b5c04 commit abc5577
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/terrraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@ jobs:
BRANCH_NAME="${{ github.head_ref || github.ref_name }}"
if [ -f "tf-cfg.yaml" ]; then
BRANCH_CONFIG=$(cat tf-cfg.yaml)
BRANCH_CONFIG=$(cat tf-cfg.yaml | yq eval '.BRANCHES[] | select(.BRANCH == env(BRANCH_NAME))')
elif [ -f "tf-cfg.json" ]; then
BRANCH_CONFIG=$(cat tf-cfg.json)
BRANCH_CONFIG=$(cat tf-cfg.json | yq eval '.BRANCHES[] | select(.BRANCH == env(BRANCH_NAME))')
else
BRANCH_CONFIG="${{ env.DEFAULT_BRANCH_CONFIG }}"
fi
WORKSPACE=$(echo "$BRANCH_CONFIG" | yq eval ".WORKSPACE" -)
VARFILE=$(echo "$BRANCH_CONFIG" | yq eval ".VARFILE" -)
SHOULD_PLAN=$(echo "BRANCH_$CONFIG" | yq eval ".SHOULD_PLAN" -)
SHOULD_APPLY=$(echo "BRANCH_$CONFIG" | yq eval ".SHOULD_APPLY" -)
echo "workspace=$WORKSPACE" >> $GITHUB_OUTPUT
echo "varfile=$VARFILE" >> $GITHUB_OUTPUT
echo "should_plan=$SHOULD_PLAN" >> $GITHUB_OUTPUT
echo "should_apply=$SHOULD_APPLY" >> $GITHUB_OUTPUT

0 comments on commit abc5577

Please sign in to comment.