Compare commits

...

4 Commits

Author SHA1 Message Date
Quigley Malcolm
6868d572ba Example PR branch has artifact changes 2024-02-22 14:19:44 -08:00
Quigley Malcolm
d43061658a Update Check Artifact Changes to use dorny/paths-filter
Previously we were using `git diff` to check if any files had changed
in `core/dbt/artifacts`. However, our `git diff` usage was including any
changes that happened on `main` which the PR branch did not have. This
commit switches the check from using `git diff` to `dorny/paths-filter`,
which is what we use for checking for changelog existence as well. The
`dorny/paths-fitler` includes logic for excluding changes that are on main
but not the PR branch (which is what want to happen).
2024-02-22 14:16:45 -08:00
Quigley Malcolm
e357676d15 Move artifact_minor_upgrade label check to job level of Check Artifact Changes
Previously the checking for `artifact_minor_upgrade` was happening in each job
step of `Check Artifact Changes`. By moving it up to the job level instead of
in the job steps we make it so the check for the label only happens once and
it simplifies the job steps.
2024-02-22 14:16:45 -08:00
Quigley Malcolm
de57bade9d Remove extraneous / in schema-check.yml
We have hypothesis that the extra `/` in `schema-check` is causing
issues we're seeing currently in the artifact check failing. It may
not be the final solution, but we should fix it anyway.
2024-02-22 10:47:38 -08:00
3 changed files with 15 additions and 15 deletions

View File

@@ -10,6 +10,7 @@ on:
jobs:
check-artifact-changes:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'artifact_minor_upgrade') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -17,26 +18,24 @@ jobs:
fetch-depth: 0
- name: Check for changes in core/dbt/artifacts
id: check_changes
run: |
# Check for changes in dbt/artifacts
CHANGED_FILES=$(git diff --name-only origin/${GITHUB_BASE_REF} origin/${GITHUB_HEAD_REF} | grep 'core/dbt/artifacts/')
if [ ! -z "$CHANGED_FILES" ]; then
echo "CHANGED=true" >> $GITHUB_ENV
echo "Changed files in core/dbt/artifacts:"
echo "$CHANGED_FILES"
else
echo "CHANGED=false" >> $GITHUB_ENV
fi
# https://github.com/marketplace/actions/paths-changes-filter
uses: dorny/paths-filter@v3
id: check_artifact_changes
with:
filters: |
artifacts_changed:
- 'core/dbt/artifacts/**'
list-files: shell
- name: Fail CI if artifacts have changed
if: env.CHANGED == 'true' && !contains(github.event.pull_request.labels.*.name, 'artifact_minor_upgrade')
if: steps.check_artifact_changes.outputs.artifacts_changed == 'true'
run: |
echo "CI failure: Artifact changes checked in core/dbt/artifacts directory."
echo "Files changed: ${{ steps.check_artifact_changes.outputs.artifacts_changed_files }}"
echo "To bypass this check, confirm that the change is not breaking (https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/artifacts/README.md#breaking-changes) and add the 'artifact_minor_upgrade' label to the PR."
exit 1
- name: CI check passed
if: env.CHANGED == 'false' || contains(github.event.pull_request.labels.*.name, 'artifact_minor_upgrade')
if: steps.check_artifact_changes.outputs.artifacts_changed == 'false'
run: |
echo "No prohibited artifact changes checked in core/dbt/artifacts, or 'artifact_minor_upgrade' label found. CI check passed."
echo "No prohibited artifact changes found in core/dbt/artifacts. CI check passed."

View File

@@ -26,7 +26,7 @@ permissions: read-all
env:
LATEST_SCHEMA_PATH: ${{ github.workspace }}/new_schemas
SCHEMA_DIFF_ARTIFACT: ${{ github.workspace }}//schema_schanges.txt
SCHEMA_DIFF_ARTIFACT: ${{ github.workspace }}/schema_schanges.txt
DBT_REPO_DIRECTORY: ${{ github.workspace }}/dbt
SCHEMA_REPO_DIRECTORY: ${{ github.workspace }}/schemas.getdbt.com

View File

@@ -14,6 +14,7 @@ class BaseResource(dbtClassMixin):
path: str
original_file_path: str
unique_id: str
new_property: Optional[str]
@dataclass