name: Lint on: push: branches: [main] pull_request: jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Reject changes under legacy docs/ if: github.event_name == 'pull_request' run: | set -euo pipefail BASE_REF="${{ github.base_ref }}" # Refresh origin/ with full history; --depth=1 would # shallow the ref and break the merge-base used by `...`. git fetch --no-tags origin "$BASE_REF" # First, verify the diff itself succeeds and check whether any # files changed. A silent failure here would let docs/ changes # through, so the explicit `if !` guard is important. if ! CHANGED=$(git diff --name-only --diff-filter=ACMRDTUXB "origin/${BASE_REF}...HEAD"); then echo "git diff origin/${BASE_REF}...HEAD failed; aborting." >&2 exit 2 fi if [ -z "$CHANGED" ]; then echo "No changed files vs origin/${BASE_REF}; skipping." exit 0 fi # Re-emit with -z so xargs can safely handle whitespace in paths. git diff -z --name-only --diff-filter=ACMRDTUXB "origin/${BASE_REF}...HEAD" \ | xargs -0 python3 scripts/ci/check_no_docs_changes.py - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.12" - name: Install pre-commit hook run: | python -m pip install pre-commit pre-commit install - name: Run pre-commit checks run: SKIP=no-commit-to-branch pre-commit run --all-files --show-diff-on-failure - name: Run lychee docs checks (offline references) uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2 with: args: --config .github/linters/lychee.toml README.md "docs/**/*.md" "docs/**/*.rst" "docs/**/*.ipynb" - name: Run sgl-kernel clang-format checks uses: DoozyX/clang-format-lint-action@v0.20 with: source: sgl-kernel extensions: h,c,cpp,hpp,cu,cuh,cc clangFormatVersion: 20 style: file