The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
centralize linting workflows (#79673)
Chris Vandoodewaard9b9b40a5f900
diff --git a/.github/actionlint.yaml b/.github/actionlint.yamlindex aadda76f6dc..bd0b75c6f99 100644--- a/.github/actionlint.yaml+++ b/.github/actionlint.yaml@@ -3,3 +3,11 @@ self-hosted-runner:# selected through `vars.DEFAULT_RUNNER_KEY` and is not checked.labels:- arm-ubuntu-24-2core++paths:+ # GitHub added parallel steps (`parallel`, `background`, `wait`, `wait-all`,+ # `cancel`) in June 2026, and actionlint 1.7.12 does not know the schema yet:+ # https://github.blog/changelog/2026-06-25-actions-steps-can-now-be-run-in-parallel/+ .github/workflows/lint.yml:+ ignore:+ - 'step must run script with "run" section or run action with "uses" section'diff --git a/.github/file-paths.yaml b/.github/file-paths.yamlindex 68a6990cd7e..9eb83e726d3 100644--- a/.github/file-paths.yaml+++ b/.github/file-paths.yaml@@ -176,7 +176,7 @@ embedding_sdk_host_sample_apps:- "e2e/test-host-app/**/*.cy.*.{js,ts}"snowplow: &snowplow- - ".github/workflows/snowplow.yml"+ - ".github/workflows/lint.yml"- "snowplow/**"- "bin/lint-snowplow-schemas.bb"- "bin/lint-snowplow-schemas-test.bb"@@ -205,7 +205,7 @@ yaml:- "**/*.yaml"codeql:- - ".github/workflows/codeql.yml"+ - ".github/workflows/lint.yml"- "frontend/src/**"- "enterprise/frontend/src/**"@@ -213,7 +213,7 @@ i18n:- *default- ".github/actions/prepare-frontend/**"- ".github/actions/prepare-backend/**"- - ".github/workflows/i18n.yml"+ - ".github/workflows/lint.yml"- *sourcescljs:@@ -227,7 +227,7 @@ serialization_baseline:- "test_resources/serialization_baseline/**"openapi:- - ".github/workflows/openapi.yml"+ - ".github/workflows/lint.yml"- "src/metabase/api/**"- "src/metabase/api_routes/**"- "src/metabase/*_rest/api.clj"diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.ymldeleted file mode 100644index 24ca7d02469..00000000000--- a/.github/workflows/actionlint.yml+++ /dev/null@@ -1,44 +0,0 @@-name: Actionlint--on:- push:- branches:- - 'master'- - 'release-**'- paths:- - '.github/workflows/**'- pull_request:- paths:- - '.github/workflows/**'--concurrency:- group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}- cancel-in-progress: true--jobs:- actionlint:- name: Lint Github Actions Workflows- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- steps:- - uses: actions/checkout@v6- - name: Get changed Github actions- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml- list-files: shell- - name: Setup actionlint- if: steps.changes.outputs.actionlint == 'true'- id: download- shell: bash- run: |- if command -v actionlint; then- echo "executable=actionlint" >> "$GITHUB_OUTPUT"- else- # script sets executable output, for details see: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions- bash <(curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/v1.7.12/scripts/download-actionlint.bash)- fi- - name: Run actionlint- if: steps.changes.outputs.actionlint == 'true'- run: ${{ steps.download.outputs.executable }} --color --verbose ${{ steps.changes.outputs.actionlint_files }}diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.ymldeleted file mode 100644index 02700dfc749..00000000000--- a/.github/workflows/codeql.yml+++ /dev/null@@ -1,39 +0,0 @@-name: "CodeQL"--on:- push:- branches:- - 'master'- - 'release-**'- pull_request:--jobs:- files-changed:- name: Check which files changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 3- outputs:- codeql: ${{ steps.changes.outputs.codeql }}- steps:- - uses: actions/checkout@v6- - name: Test which files changed- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml- analyze:- needs: files-changed- if: needs.files-changed.outputs.codeql == 'true'- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- steps:- - name: Checkout repository- uses: actions/checkout@v6- - name: Initialize CodeQL- uses: github/codeql-action/init@v4- with:- languages: javascript- config-file: ./.github/codeql/codeql-config.yml- trap-caching: false- - name: Perform CodeQL Analysis- uses: github/codeql-action/analyze@v4diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.ymldeleted file mode 100644index a02bea6044e..00000000000--- a/.github/workflows/i18n.yml+++ /dev/null@@ -1,51 +0,0 @@-name: i18n--on:- push:- branches:- - 'master'- - 'release-**'- pull_request:--concurrency:- group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}- cancel-in-progress: true--jobs:- files-changed:- name: Check which files changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 3- outputs:- i18n: ${{ steps.changes.outputs.i18n }}- steps:- - uses: actions/checkout@v6- - name: Test which files changed- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml-- verify-i18n-files:- needs: files-changed- if: needs.files-changed.outputs.i18n == 'true'- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 15- steps:- - uses: actions/checkout@v6- - name: Prepare front-end environment- uses: ./.github/actions/prepare-frontend- - name: Prepare back-end environment- uses: ./.github/actions/prepare-backend- - name: Install xgettext if necessary- run: |- if ! command -v xgettext > /dev/null; then- sudo apt install gettext- fi- - name: Check xgettext version- run: xgettext --version- - name: Check i18n tags/make sure template can be built- run: ./bin/i18n/update-translation-template- - name: Verify i18n translations (.po files)- run: ./bin/i18n/build-translation-resourcesdiff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlnew file mode 100644index 00000000000..a4cf15a9ee4--- /dev/null+++ b/.github/workflows/lint.yml@@ -0,0 +1,184 @@+name: Lint++on:+ push:+ branches:+ - 'master'+ - 'release-**'+ pull_request:++concurrency:+ group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}+ cancel-in-progress: true++jobs:+ files-changed:+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 10+ outputs:+ actionlint: ${{ steps.changes.outputs.actionlint }}+ actionlint_files: ${{ steps.changes.outputs.actionlint_files }}+ codeql: ${{ steps.changes.outputs.codeql }}+ i18n: ${{ steps.changes.outputs.i18n }}+ openapi: ${{ steps.changes.outputs.openapi }}+ snowplow: ${{ steps.changes.outputs.snowplow }}+ yaml: ${{ steps.changes.outputs.yaml }}+ steps:+ - uses: actions/checkout@v6++ - name: Test which files changed+ uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1+ id: changes+ with:+ token: ${{ github.token }}+ filters: .github/file-paths.yaml+ list-files: shell++ lint:+ needs: files-changed+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 10+ steps:+ - uses: actions/checkout@v6++ - name: Setup frontend env+ if: |+ needs.files-changed.outputs.yaml == 'true' ||+ needs.files-changed.outputs.openapi == 'true'+ uses: ./.github/actions/prepare-frontend++ # Always required by whitespace linter, also used by OpenAPI spec validation+ - name: Setup backend env+ uses: ./.github/actions/prepare-backend++ - name: Setup actionlint+ if: needs.files-changed.outputs.actionlint == 'true'+ id: download+ shell: bash+ run: |+ if command -v actionlint; then+ echo "executable=actionlint" >> "$GITHUB_OUTPUT"+ else+ # script sets executable output, for details see: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions+ bash <(curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/v1.7.12/scripts/download-actionlint.bash)+ fi++ - parallel:+ # Lint whitespace, always runs+ - name: Run Whitespace Linter+ run: clojure -T:whitespace-linter lint :whitespace-linter/progress-bar false++ # Lint YAML+ - name: Lint YAML files+ if: needs.files-changed.outputs.yaml == 'true'+ run: bun run lint-yaml++ # Lint Github Actions+ - name: Run actionlint+ if: needs.files-changed.outputs.actionlint == 'true'+ run: ${{ steps.download.outputs.executable }} --color --verbose ${{ needs.files-changed.outputs.actionlint_files }}++ # Generate and Lint OpenAPI spec+ - name: Generate OpenAPI spec+ if: needs.files-changed.outputs.openapi == 'true'+ run: bun run generate-openapi++ # Parallel steps run asynchronously, and explicitly waiting for a parallel step means "if" statements are ignored.+ # Move OpenAPI validation outside the parallel block so that spec generation happens asynchronously without requiring+ # an explicit "wait".+ - name: Validate OpenAPI spec+ if: needs.files-changed.outputs.openapi == 'true'+ run: bun run lint-openapi++ codeql:+ if: needs.files-changed.outputs.codeql == 'true'+ needs: files-changed+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 10+ steps:+ - uses: actions/checkout@v6++ - name: Initialize CodeQL+ uses: github/codeql-action/init@v4+ with:+ languages: javascript+ config-file: ./.github/codeql/codeql-config.yml+ trap-caching: false+ - name: Perform CodeQL Analysis+ uses: github/codeql-action/analyze@v4++ i18n:+ needs: files-changed+ if: needs.files-changed.outputs.i18n == 'true'+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ timeout-minutes: 15+ steps:+ - uses: actions/checkout@v6+ - name: Prepare front-end environment+ uses: ./.github/actions/prepare-frontend+ - name: Prepare back-end environment+ uses: ./.github/actions/prepare-backend+ - name: Install xgettext if necessary+ run: |+ if ! command -v xgettext > /dev/null; then+ sudo apt install gettext+ fi+ - name: Check xgettext version+ run: xgettext --version+ - name: Check i18n tags/make sure template can be built+ run: ./bin/i18n/update-translation-template+ - name: Verify i18n translations (.po files)+ run: ./bin/i18n/build-translation-resources++ snowplow:+ needs: files-changed+ if: needs.files-changed.outputs.snowplow == 'true'+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}+ steps:+ - name: Checkout+ uses: actions/checkout@v6+ - name: Set up Java+ uses: actions/[email protected]+ with:+ distribution: temurin+ java-version: 25+ - name: Set up Babashka+ uses: turtlequeue/setup-babashka@d78ec6570aea3b614bc695cafcceb82eb45c2af9 # v1.8.0+ with:+ babashka-version: 1.12.197+ - name: Install igluctl+ run: |+ set -euo pipefail+ curl -fsSL -o "$RUNNER_TEMP/igluctl.zip" https://github.com/snowplow/igluctl/releases/download/0.13.0/igluctl_0.13.0.zip+ echo "0eac19121fca1431dec44738ada8eacc4242811a95d015ee71e00deec2b4d748 $RUNNER_TEMP/igluctl.zip" | sha256sum -c -+ unzip -q "$RUNNER_TEMP/igluctl.zip" -d "$RUNNER_TEMP/igluctl"+ chmod +x "$RUNNER_TEMP/igluctl/igluctl"+ echo "$RUNNER_TEMP/igluctl" >> "$GITHUB_PATH"+ - name: Lint (igluctl)+ # igluctl recursively parses every file as JSON, so it chokes on colocated+ # *.md docs and on two schemas whose internal `self.version` doesn't match+ # the filename version (pending Snowcat audit). Stage a filtered copy and+ # patch only the `self.version` mismatch so igluctl still lints the rest+ # of those schemas.+ run: |+ set -euo pipefail+ LINT_ROOT="$RUNNER_TEMP/iglu-lint"+ rm -rf "$LINT_ROOT"+ mkdir -p "$LINT_ROOT"+ cp -r snowplow/iglu-client-embedded/schemas "$LINT_ROOT/"+ find "$LINT_ROOT" -name '*.md' -delete+ # TODO(BOT-1403): drop these patches once the Snowcat audit fixes the+ # internal `self.version` mismatch on these two schemas. We rewrite+ # only `self.version` in the staged copy so the file's path version+ # matches what igluctl expects; every other lint rule still runs.+ # Each `sed` invocation uses the schema's wrong/right pair, so it+ # silently no-ops once the underlying schema is fixed.+ sed -i 's/"version": "1-0-1"/"version": "1-0-2"/' \+ "$LINT_ROOT/schemas/com.metabase/embed_share/jsonschema/1-0-2"+ sed -i 's/"version": "1-0-0"/"version": "1-0-1"/' \+ "$LINT_ROOT/schemas/com.metabase/serialization/jsonschema/1-0-1"+ igluctl lint "$LINT_ROOT/schemas"+ - name: Lint (Metabase schema rules)+ run: ./bin/lint-snowplow-schemas.bb+ - name: Test linter rules+ run: ./bin/lint-snowplow-schemas-test.bbdiff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.ymldeleted file mode 100644index 3f015872947..00000000000--- a/.github/workflows/openapi.yml+++ /dev/null@@ -1,44 +0,0 @@-name: Validate OpenAPI--on:- push:- branches:- - 'master'- - 'release-**'- pull_request:--concurrency:- group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}- cancel-in-progress: true--jobs:- files-changed:- name: Check which files changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 3- outputs:- openapi: ${{ steps.changes.outputs.openapi }}- steps:- - uses: actions/checkout@v6- - name: Test which files changed- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml-- validate-openapi:- needs: files-changed- if: needs.files-changed.outputs.openapi == 'true'- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 10- steps:- - uses: actions/checkout@v6- - name: Prepare front-end environment- uses: ./.github/actions/prepare-frontend- - name: Prepare back-end environment- uses: ./.github/actions/prepare-backend- - name: Generate OpenAPI spec- run: bun run generate-openapi- - name: Validate OpenAPI spec- run: bun run lint-openapidiff --git a/.github/workflows/snowplow.yml b/.github/workflows/snowplow.ymldeleted file mode 100644index 7eb3aaf5277..00000000000--- a/.github/workflows/snowplow.yml+++ /dev/null@@ -1,75 +0,0 @@-name: Snowplow--on:- pull_request:- branches:- - '**'--jobs:- files-changed:- name: Check which files changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 3- outputs:- snowplow: ${{ steps.changes.outputs.snowplow }}- steps:- - uses: actions/checkout@v6- - name: Test which files changed- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml-- lint:- needs: files-changed- if: needs.files-changed.outputs.snowplow == 'true'- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- steps:- - name: Checkout- uses: actions/checkout@v6- - name: Set up Java- uses: actions/[email protected]- with:- distribution: temurin- java-version: 25- - name: Set up Babashka- uses: turtlequeue/setup-babashka@d78ec6570aea3b614bc695cafcceb82eb45c2af9 # v1.8.0- with:- babashka-version: 1.12.197- - name: Install igluctl- run: |- set -euo pipefail- curl -fsSL -o "$RUNNER_TEMP/igluctl.zip" https://github.com/snowplow/igluctl/releases/download/0.13.0/igluctl_0.13.0.zip- echo "0eac19121fca1431dec44738ada8eacc4242811a95d015ee71e00deec2b4d748 $RUNNER_TEMP/igluctl.zip" | sha256sum -c -- unzip -q "$RUNNER_TEMP/igluctl.zip" -d "$RUNNER_TEMP/igluctl"- chmod +x "$RUNNER_TEMP/igluctl/igluctl"- echo "$RUNNER_TEMP/igluctl" >> "$GITHUB_PATH"- - name: Lint (igluctl)- # igluctl recursively parses every file as JSON, so it chokes on colocated- # *.md docs and on two schemas whose internal `self.version` doesn't match- # the filename version (pending Snowcat audit). Stage a filtered copy and- # patch only the `self.version` mismatch so igluctl still lints the rest- # of those schemas.- run: |- set -euo pipefail- LINT_ROOT="$RUNNER_TEMP/iglu-lint"- rm -rf "$LINT_ROOT"- mkdir -p "$LINT_ROOT"- cp -r snowplow/iglu-client-embedded/schemas "$LINT_ROOT/"- find "$LINT_ROOT" -name '*.md' -delete- # TODO(BOT-1403): drop these patches once the Snowcat audit fixes the- # internal `self.version` mismatch on these two schemas. We rewrite- # only `self.version` in the staged copy so the file's path version- # matches what igluctl expects; every other lint rule still runs.- # Each `sed` invocation uses the schema's wrong/right pair, so it- # silently no-ops once the underlying schema is fixed.- sed -i 's/"version": "1-0-1"/"version": "1-0-2"/' \- "$LINT_ROOT/schemas/com.metabase/embed_share/jsonschema/1-0-2"- sed -i 's/"version": "1-0-0"/"version": "1-0-1"/' \- "$LINT_ROOT/schemas/com.metabase/serialization/jsonschema/1-0-1"- igluctl lint "$LINT_ROOT/schemas"- - name: Lint (Metabase schema rules)- run: ./bin/lint-snowplow-schemas.bb- - name: Test linter rules- run: ./bin/lint-snowplow-schemas-test.bbdiff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.ymldeleted file mode 100644index 6cbd5bf08d3..00000000000--- a/.github/workflows/whitespace.yml+++ /dev/null@@ -1,20 +0,0 @@-name: Whitespace--on:- push:- branches:- - 'master'- - 'release-**'- pull_request:- merge_group:--jobs:- whitespace-linter:- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 5- steps:- - uses: actions/checkout@v6- - name: Prepare back-end environment- uses: ./.github/actions/prepare-backend- - run: clojure -T:whitespace-linter lint :whitespace-linter/progress-bar false- name: Run Whitespace Linterdiff --git a/.github/workflows/yaml.yml b/.github/workflows/yaml.ymldeleted file mode 100644index 03ecb674319..00000000000--- a/.github/workflows/yaml.yml+++ /dev/null@@ -1,35 +0,0 @@-name: YAML--on:- push:- branches:- - 'master'- - 'release-**'- pull_request:--jobs:- files-changed:- name: Check which files changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 3- outputs:- yaml: ${{ steps.changes.outputs.yaml }}- steps:- - uses: actions/checkout@v6- - name: Test which files changed- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml-- yaml-linter:- needs: files-changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- if: needs.files-changed.outputs.yaml == 'true'- timeout-minutes: 10- steps:- - uses: actions/checkout@v6- - name: Prepare front-end environment- uses: ./.github/actions/prepare-frontend- - run: bun run lint-yaml