feat(release): separate stack artifact inventories #155
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: Apache-2.0 | |
| # Lint first-party markdown. | |
| # | |
| # Blocking. The job started out reporting only, while the tree still had 4791 | |
| # violations, and flipped once the cleanup reached zero. Lint findings now fail | |
| # the build, which is the whole point of the exercise: a reporting job nobody | |
| # has to fix decays into noise. | |
| # | |
| # If this fails on your change, run the same command locally: | |
| # | |
| # git ls-files '*.md' > /tmp/tracked.txt | |
| # tr '\n' '\0' < /tmp/tracked.txt | xargs -0 markdownlint | |
| # | |
| # markdownlint --fix handles most findings. Check what it rewrote before | |
| # committing: it parses fenced code as prose when a fence is mispaired, and | |
| # will edit the contents of a block it should not touch. | |
| name: Markdown Lint | |
| on: | |
| push: | |
| branches: [main, 'release-**'] | |
| paths: | |
| - '**/*.md' | |
| - '.markdownlint.json' | |
| - '.markdownlintignore' | |
| - '.github/workflows/markdown-lint.yml' | |
| pull_request: | |
| branches: [main, 'release-**'] | |
| paths: | |
| - '**/*.md' | |
| - '.markdownlint.json' | |
| - '.markdownlintignore' | |
| - '.github/workflows/markdown-lint.yml' | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: markdown-lint-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| markdownlint: | |
| name: Lint markdown | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| # Node 20 reached end of life on 2026-03-24, and markdownlint-cli | |
| # 0.49.1 declares engines.node >=22, so 20 would install with a | |
| # warning and run unsupported. | |
| node-version: '24' | |
| - name: Install markdownlint-cli | |
| env: | |
| # Pinned so a markdownlint release that adds or tightens a rule | |
| # cannot move the reported count with no commit here to explain it. | |
| # Bump deliberately, and note the count change in the pull request. | |
| MARKDOWNLINT_CLI_VERSION: "0.49.1" | |
| run: | | |
| set -euo pipefail | |
| npm install -g "markdownlint-cli@${MARKDOWNLINT_CLI_VERSION}" | |
| - name: Run markdownlint | |
| run: | | |
| set -uo pipefail | |
| # markdownlint exits 0 clean, 1 for lint findings, and 2 or above | |
| # for an execution error (unwritable output, bad config, unexpected | |
| # failure). xargs collapses every one of those non-zero codes to | |
| # 123, so calling it directly would make a broken run look like a | |
| # pile of findings and publish a meaningless count. | |
| # | |
| # This wrapper records the real status of each invocation and always | |
| # exits 0, so xargs cannot mask it. | |
| status_file="${RUNNER_TEMP}/status.txt" | |
| : > "${status_file}" | |
| cat > "${RUNNER_TEMP}/mdl.sh" <<SH | |
| #!/usr/bin/env bash | |
| markdownlint "\$@" | |
| printf '%s\n' "\$?" >> "${status_file}" | |
| exit 0 | |
| SH | |
| chmod +x "${RUNNER_TEMP}/mdl.sh" | |
| # Git-tracked files only, minus the vendored trees excluded by | |
| # .markdownlintignore. A bare '**/*.md' would also walk build | |
| # output and node_modules. | |
| # | |
| # The file list goes through stdin rather than xargs -a so this is | |
| # the same command contributors can run on macOS, where BSD xargs | |
| # has no -a. -0 keeps paths containing whitespace intact. | |
| git ls-files '*.md' > "${RUNNER_TEMP}/tracked.txt" | |
| tr '\n' '\0' < "${RUNNER_TEMP}/tracked.txt" \ | |
| | xargs -0 "${RUNNER_TEMP}/mdl.sh" > "${RUNNER_TEMP}/out.txt" 2>&1 | |
| # Worst status across invocations, 0 if xargs never ran the wrapper. | |
| worst="$(sort -rn "${status_file}" | head -1)" | |
| worst="${worst:-0}" | |
| if [ "${worst}" -gt 1 ]; then | |
| echo "::error::markdownlint failed to execute (exit ${worst})" | |
| cat "${RUNNER_TEMP}/out.txt" | |
| { | |
| echo "## Markdown lint" | |
| echo | |
| echo "markdownlint failed to execute (exit ${worst})." | |
| echo "No violation count was produced." | |
| } >> "${GITHUB_STEP_SUMMARY}" | |
| # Distinct from a lint failure below: there is no count at all | |
| # here, so the summary must not imply the tree was measured. | |
| exit 1 | |
| fi | |
| total="$(wc -l < "${RUNNER_TEMP}/out.txt" | tr -d ' ')" | |
| files="$(cut -d: -f1 "${RUNNER_TEMP}/out.txt" | sort -u | wc -l | tr -d ' ')" | |
| if [ "${total}" -eq 0 ]; then | |
| echo "markdownlint: clean" | |
| exit 0 | |
| fi | |
| cat "${RUNNER_TEMP}/out.txt" | |
| { | |
| echo "## Markdown lint" | |
| echo | |
| echo "${total} violation(s) across ${files} file(s)." | |
| echo | |
| echo '```text' | |
| head -50 "${RUNNER_TEMP}/out.txt" | |
| echo '```' | |
| echo | |
| echo "### By rule" | |
| echo | |
| echo '```text' | |
| grep -oE 'MD[0-9]{3}' "${RUNNER_TEMP}/out.txt" \ | |
| | sort | uniq -c | sort -rn | head -20 | |
| echo '```' | |
| } >> "${GITHUB_STEP_SUMMARY}" | |
| echo "::error::markdownlint: ${total} violations across ${files} files" | |
| exit 1 |