docs(readme): add images and shields badges #152
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| # SPDX-License-Identifier: LicenseRef-NvidiaProprietary | |
| # | |
| # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual | |
| # property and proprietary rights in and to this material, related | |
| # documentation and any modifications thereto. Any use, reproduction, | |
| # disclosure or distribution of this material and related documentation | |
| # without an express license agreement from NVIDIA CORPORATION or | |
| # its affiliates is strictly prohibited. | |
| name: Check for Large Files and Restricted Extensions | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize, reopened] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-files: | |
| name: Check file size and type | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| set-safe-directory: true | |
| fetch-depth: 1 | |
| - name: Fetch base branch | |
| run: git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 | |
| - name: Check for large files | |
| run: | | |
| MAX_SIZE_BYTES=102400 # 100KB | |
| MAX_SIZE_HUMAN="100KB" | |
| # Exempt image formats and notebooks (documentation/tutorial assets) | |
| EXEMPT_EXTENSIONS="(png|jpg|jpeg|gif|svg|ico|webp|ipynb)" | |
| LARGE_FILES="" | |
| while IFS= read -r file; do | |
| if [[ "$file" =~ \.($EXEMPT_EXTENSIONS)$ ]]; then | |
| continue | |
| fi | |
| if [[ -f "$file" ]]; then | |
| size=$(stat --format='%s' "$file") | |
| if (( size > MAX_SIZE_BYTES )); then | |
| human_size=$(numfmt --to=iec "$size") | |
| LARGE_FILES+=" $file ($human_size)"$'\n' | |
| fi | |
| fi | |
| done < <(git diff --name-only --diff-filter=A origin/${{ github.event.pull_request.base.ref }}) | |
| if [[ -n "$LARGE_FILES" ]]; then | |
| echo "❌ The following files exceed the allowed size of $MAX_SIZE_HUMAN:" | |
| echo "$LARGE_FILES" | |
| exit 1 | |
| fi | |
| - name: Check for restricted file types | |
| run: | | |
| BLOCKED_EXTENSIONS="(exe|zip|tar.gz|bz2)" # Add any forbidden extensions | |
| BAD_FILES=$(git diff --name-only --diff-filter=A origin/${{ github.event.pull_request.base.ref }} | grep -E "\.($BLOCKED_EXTENSIONS)$" || true) | |
| if [[ ! -z "$BAD_FILES" ]]; then | |
| echo "❌ The following files have restricted extensions:" | |
| echo "$BAD_FILES" | |
| exit 1 | |
| fi |