Files
superset2/.github/workflows/pre-commit.yml
Joe Li 3aebd88087 ci(pre-commit): install helm-docs via go instead of untrusted brew tap (#973)
Homebrew rolled out an untrusted-tap security change on the GitHub runner
image that makes `brew install norwoodj/tap/helm-docs` fail with "Skipping
norwoodj/tap because it is not trusted", so the pre-commit workflow's
"Enable brew and helm-docs" step now exits non-zero before the hooks ever
run. This turned the "pre-commit checks" job red on every push regardless of
the diff.

Replace the brew tap install with `go install
github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14.2`, matching apache/superset
upstream and keeping the binary version aligned with the helm-docs pre-commit
hook rev in .pre-commit-config.yaml.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 11:29:42 -07:00

87 lines
3.0 KiB
YAML

name: pre-commit checks
on:
push:
branches:
- "master"
- "[0-9].[0-9]*"
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["current", "previous", "next"]
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
- name: Setup Python
uses: ./.github/actions/setup-backend/
with:
python-version: ${{ matrix.python-version }}
- name: Setup Go
uses: actions/setup-go@v5
- name: Install helm-docs
# Previously `brew install norwoodj/tap/helm-docs`, but Homebrew now
# refuses to install from untrusted third-party taps ("Skipping
# norwoodj/tap because it is not trusted"), which breaks CI. Install the
# pinned binary directly with Go instead — this matches apache/superset
# upstream and keeps the version aligned with the helm-docs pre-commit
# hook rev in .pre-commit-config.yaml.
run: go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14.2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Frontend Dependencies
run: |
cd superset-frontend
npm ci
- name: Install Docs Dependencies
run: |
cd docs
yarn install --immutable
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-
- name: pre-commit
run: |
set +e # Don't exit immediately on failure
export SKIP=eslint-frontend,type-checking-frontend
pre-commit run --all-files
PRE_COMMIT_EXIT_CODE=$?
git diff --quiet --exit-code
GIT_DIFF_EXIT_CODE=$?
if [ "${PRE_COMMIT_EXIT_CODE}" -ne 0 ] || [ "${GIT_DIFF_EXIT_CODE}" -ne 0 ]; then
if [ "${PRE_COMMIT_EXIT_CODE}" -ne 0 ]; then
echo "❌ Pre-commit check failed (exit code: ${EXIT_CODE})."
else
echo "❌ Git working directory is dirty."
echo "📌 This likely means that pre-commit made changes that were not committed."
echo "🔍 Modified files:"
git diff --name-only
fi
echo "🚒 To prevent/address this CI issue, please install/use pre-commit locally."
echo "📖 More details here: https://superset.apache.org/docs/contributing/development#git-hooks"
exit 1
fi