Skip to content

Several python notebooks fix (#4144) #19325

Several python notebooks fix (#4144)

Several python notebooks fix (#4144) #19325

Workflow file for this run

# ============================================================================ #
# Copyright (c) 2022 - 2026 NVIDIA Corporation & Affiliates. #
# All rights reserved. #
# #
# This source code and the accompanying materials are made available under #
# the terms of the Apache License 2.0 which accompanies this distribution. #
# ============================================================================ #
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
merge_group:
types:
- checks_requested
name: "Basic content checks"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# ==========================================================================
# Job 1: Code Formatting (clang-format, yapf, markdownlint, file quality)
# ==========================================================================
formatting:
name: Check code formatting
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup pre-commit
id: setup
uses: ./.github/actions/setup-precommit
with:
cache-key-suffix: formatting
# No extra tools needed - pre-commit provides clang-format/yapf
- name: Run formatting checks
run: |
# TODO: Enable end-of-file-fixer, trailing-whitespace, mixed-line-ending when enabled in .pre-commit-config.yaml
HOOKS="clang-format yapf markdownlint check-added-large-files check-case-conflict check-merge-conflict check-symlinks check-yaml check-toml check-json"
EXIT_CODE=0
for hook in $HOOKS; do
echo "::group::Running hook: $hook"
if [ "${{ steps.setup.outputs.mode }}" == "pr" ]; then
cat ${{ steps.setup.outputs.changed-files }} | xargs -r pre-commit run $hook --files || EXIT_CODE=$?
else
pre-commit run $hook --all-files --show-diff-on-failure || EXIT_CODE=$?
fi
echo "::endgroup::"
done
exit $EXIT_CODE
# ==========================================================================
# Job 2: License Headers
# ==========================================================================
license_headers:
name: Check license headers
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1 # Shallow clone - runs on all files, no git diff needed
- name: Setup pre-commit
uses: ./.github/actions/setup-precommit
with:
cache-key-suffix: license
install-go: 'true' # For license-eye
- name: Run license header checks
run: |
HOOKS="license-headers spellcheck-allowlist-sorted"
EXIT_CODE=0
for hook in $HOOKS; do
echo "::group::Running hook: $hook"
pre-commit run $hook --all-files --hook-stage pre-push || EXIT_CODE=$?
echo "::endgroup::"
done
exit $EXIT_CODE
# ==========================================================================
# Job 3: Spell Checking
# ==========================================================================
spelling:
name: Check spelling
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup pre-commit
id: setup
uses: ./.github/actions/setup-precommit
with:
cache-key-suffix: spelling
install-aspell: 'true' # For spell checking
- name: Run spell checks
run: |
pre-commit run spellcheck --all-files --hook-stage pre-push
# ==========================================================================
# Job 4: Link Validation
# ==========================================================================
links:
name: Check links
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup pre-commit
id: setup
uses: ./.github/actions/setup-precommit
with:
cache-key-suffix: links
install-node: 'true' # For markdown-link-check
- name: Run link checks
run: |
if [ "${{ steps.setup.outputs.mode }}" == "pr" ]; then
cat ${{ steps.setup.outputs.changed-files }} | grep '\.md$' || true | xargs -r pre-commit run markdown-link-check --hook-stage pre-push --files
else
pre-commit run markdown-link-check --all-files --hook-stage pre-push
fi