Skip to content

feat(CI): Enforce charts metadata backward compatibility check #33180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
64 changes: 64 additions & 0 deletions .github/workflows/metadata-backward-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "Chart Metadata Backward Compatibility Check"

on:
push:
branches:
- "master"
- "[0-9].[0-9]*"
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
backward-compatibility-check:
runs-on: ubuntu-24.04

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
submodules: recursive

- name: "Set up Git"
run: |
git fetch origin master

- name: "Check for changes in critical files"
id: check_changes
run: |
CHANGED_FILES=$(git diff --name-only origin/master...HEAD)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this runs diff against master but the base might be different?

echo "Changed files: $CHANGED_FILES"

if echo "$CHANGED_FILES" | grep -qE '^superset-frontend/plugins/.*/(transformProps|controlPanel)'; then
echo "BACKWARD_COMPATIBILITY_CHECK_FAILED=true" >> $GITHUB_ENV
else
echo "BACKWARD_COMPATIBILITY_CHECK_FAILED=false" >> $GITHUB_ENV
fi

- name: "Check for 'validation:backward-compatible' label"
if: env.BACKWARD_COMPATIBILITY_CHECK_FAILED == 'true'
uses: actions/github-script@v7
with:
script: |
const payload = context.payload.pull_request;
const validationLabelPresent = !!payload.labels.find(label => label.name.includes('validation:backward-compatible'));
if (!validationLabelPresent) {
core.setFailed(
[
"🚨 Identified potential changes to the chart metadata in `transformProps` or `controlPanel`.",
"⚠️ Such changes may affect backward compatibility and cause charts dependent on previous metadata to break.",
"✅ To proceed, please review your changes to confirm backward-compatibility and add the label:",
"`validation:backward-compatible`",
].join("\n")
);
}

- name: "Continue with other checks"
if: env.BACKWARD_COMPATIBILITY_CHECK_FAILED == 'false'
run: |
echo "✅ No chart metadata backward compatibility issues detected. Proceeding with further checks."
Loading