Skip to content

Commit

Permalink
split out ref resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Feb 1, 2024
1 parent e7ff6d8 commit fea4e67
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/ci_dbt_core_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,41 +63,45 @@ jobs:
name: Setup Repo Refs
runs-on: ubuntu-latest
outputs:
dbt-core-ref: ${{ steps.ref.outputs.dbt-core-ref }}
dbt-common-ref: ${{ steps.ref.outputs.dbt-common-ref }}
dbt-core-ref: ${{ steps.core-ref.outputs.ref }}
dbt-common-ref: ${{ steps.common-ref.outputs.ref }}

steps:
- name: "Display job inputs"
- name: "[[DEBUG]] Input Refs"
id: job-inputs
run: |
echo "inputs.dbt-core-ref=${{ inputs.dbt-core-ref }}"
echo "inputs.dbt-common-ref=${{ inputs.dbt-common-ref }}"
- name: "Set up job outputs"
id: ref
- name: "Determine dbt-core ref"
id: core-ref
run: |
if [[ -z "${{ inputs.dbt-core-ref }}" ]]; then
DBT_CORE_REF="main"
REF="main"
else
DBT_CORE_REF=${{ inputs.dbt-core-ref }}
REF=${{ inputs.dbt-core-ref }}
fi
echo "ref=$REF" >> $GITHUB_OUTPUT
- name: "Determine dbt-common ref"
id: common-ref
run: |
if [[ -z "${{ inputs.dbt-common-ref }}" ]]; then
# these will be commits instead of branches
if [[ "${{ github.event_name }}" == "merge_group" ]]; then
DBT_COMMON_REF=${{ github.event.pull_request.merge_commit_sha }}
REF=${{ github.event.pull_request.merge_commit_sha }}
else
DBT_COMMON_REF=${{ github.event.pull_request.base.sha }}
REF=${{ github.event.pull_request.base.sha }}
fi
else
DBT_COMMON_REF=${{ inputs.dbt-common-ref }}
REF=${{ inputs.dbt-common-ref }}
fi
echo "dbt-core-ref=$DBT_CORE_REF" >> $GITHUB_OUTPUT
echo "dbt-common-ref=$DBT_COMMON_REF" >> $GITHUB_OUTPUT
echo "ref=$REF" >> $GITHUB_OUTPUT
- name: "Display Refs"
- name: "[[DEBUG]] Final Refs"
run: |
echo "dbt-core-ref=${{ steps.ref.outputs.dbt-core-ref }}"
echo "dbt-common-ref=${{ steps.ref.outputs.dbt-common-ref }}"
echo "dbt-core-ref=${{ steps.core-ref.outputs.ref }}"
echo "dbt-common-ref=${{ steps.common-ref.outputs.ref }}"
dbt-core-unit-test:
name: "Run unit tests for dbt-core"
Expand Down

0 comments on commit fea4e67

Please sign in to comment.