-
Notifications
You must be signed in to change notification settings - Fork 45
feat(docs): port Docusaurus documentation site with full build validation #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
feacd59
feat(docs): scaffold Docusaurus documentation site
WilliamBerryiii ac0faf4
docs(build): port Docusaurus site framework from hve-core
WilliamBerryiii 5038d32
feat(docs): add GitHub Pages documentation badge to README
WilliamBerryiii 43e6521
fix(docs): resolve broken links, anchors, and build warnings for Docu…
WilliamBerryiii 11dba8d
Merge remote-tracking branch 'origin/main' into docs/docusaurus-port
WilliamBerryiii f092dbc
fix(workflows): pin actions to full SHA and add top-level permissions
WilliamBerryiii d90f2b2
fix(docs): resolve markdown lint, stale ms.date, and npm vulnerability
WilliamBerryiii d4f1f59
Merge branch 'main' into docs/docusaurus-port
WilliamBerryiii ad496dd
Merge branch 'main' into docs/docusaurus-port
WilliamBerryiii d6e4009
Merge branch 'main' into docs/docusaurus-port
WilliamBerryiii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Copyright Headers | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'docs/docusaurus/src/**' | ||
| - '.github/workflows/copyright-headers.yml' | ||
| workflow_call: | ||
| inputs: | ||
| soft-fail: | ||
| description: 'Whether to continue on copyright header violations' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| copyright-headers: | ||
| name: Copyright Header Validation | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Validate copyright headers | ||
| id: validate | ||
| shell: bash | ||
| run: | | ||
| MISSING=0 | ||
| HEADER_PATTERN="Copyright (c) Microsoft Corporation" | ||
|
|
||
| echo "Checking copyright headers in docs/docusaurus/src/..." | ||
| while IFS= read -r -d '' file; do | ||
| if ! head -5 "$file" | grep -q "$HEADER_PATTERN"; then | ||
| echo "::warning file=${file}::Missing copyright header: ${file}" | ||
| MISSING=$((MISSING + 1)) | ||
| fi | ||
| done < <(find docs/docusaurus/src -type f \( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' -o -name '*.css' \) -print0) | ||
|
|
||
| echo "Files missing headers: $MISSING" | ||
| if [ "$MISSING" -gt 0 ]; then | ||
| echo "COPYRIGHT_FAILED=true" >> "$GITHUB_ENV" | ||
| fi | ||
| continue-on-error: ${{ inputs.soft-fail }} | ||
|
|
||
| - name: Check results | ||
| if: ${{ !inputs.soft-fail }} | ||
| shell: bash | ||
| run: | | ||
| if [ "$COPYRIGHT_FAILED" = "true" ]; then | ||
| echo "::error::Copyright header validation found violations" | ||
| exit 1 | ||
| fi | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Docusaurus documentation site deployment | ||
| # Prerequisite: Enable GitHub Pages in repo Settings > Pages > Source: GitHub Actions | ||
| # and allow the target branch in Settings > Environments > github-pages > Deployment branches | ||
|
|
||
| name: Deploy Documentation Site | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'docs/**' | ||
| - '.github/workflows/deploy-docs.yml' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: pages-deploy-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Docusaurus Tests | ||
| uses: ./.github/workflows/docusaurus-tests.yml | ||
| permissions: | ||
| contents: read | ||
| with: | ||
| soft-fail: false | ||
|
|
||
| build: | ||
| name: Build Docusaurus | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
|
|
||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
| cache-dependency-path: docs/docusaurus/package-lock.json | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: docs/docusaurus | ||
| run: npm ci | ||
|
|
||
| - name: Build site | ||
| working-directory: docs/docusaurus | ||
| run: npm run build | ||
|
|
||
| - name: Configure Pages | ||
| uses: actions/configure-pages@v5 | ||
|
|
||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
|
|
||
| with: | ||
| path: docs/docusaurus/build | ||
|
|
||
| deploy: | ||
| name: Deploy to GitHub Pages | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pages: write | ||
| id-token: write | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Docusaurus Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'docs/docusaurus/**' | ||
| - '.github/workflows/docusaurus-tests.yml' | ||
| workflow_call: | ||
| inputs: | ||
| soft-fail: | ||
| description: 'Whether to continue on test failures' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| docusaurus: | ||
| name: Docusaurus Unit Tests | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
|
|
||
| with: | ||
| node-version: '20' | ||
| cache: npm | ||
| cache-dependency-path: docs/docusaurus/package-lock.json | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: docs/docusaurus | ||
| run: npm ci | ||
|
|
||
| - name: Run tests | ||
| working-directory: docs/docusaurus | ||
| run: npm test | ||
| continue-on-error: ${{ inputs.soft-fail }} | ||
|
|
||
| - name: Build verification | ||
| working-directory: docs/docusaurus | ||
| run: npm run build | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
|
|
||
| with: | ||
| name: docusaurus-test-results | ||
| path: docs/docusaurus/test-results/ | ||
| retention-days: 30 | ||
| if-no-files-found: ignore | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| name: Gitleaks Secret Scan | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_call: | ||
| inputs: | ||
| soft-fail: | ||
| description: 'Whether to continue on secret detection' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Gitleaks Secret Scan | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Download and verify gitleaks | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| GITLEAKS_VERSION="8.30.0" | ||
| GITLEAKS_SHA256="79a3ab579b53f71efd634f3aaf7e04a0fa0cf206b7ed434638d1547a2470a66e" | ||
| GITLEAKS_URL="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" | ||
| GITLEAKS_TARBALL="gitleaks.tar.gz" | ||
|
|
||
| echo "Downloading gitleaks v${GITLEAKS_VERSION}..." | ||
| curl -fsSL -o "${GITLEAKS_TARBALL}" "${GITLEAKS_URL}" | ||
|
|
||
| echo "Verifying SHA256 checksum..." | ||
| echo "${GITLEAKS_SHA256} ${GITLEAKS_TARBALL}" | sha256sum -c - | ||
|
|
||
| echo "Extracting gitleaks binary..." | ||
| tar -xzf "${GITLEAKS_TARBALL}" gitleaks | ||
| chmod +x gitleaks | ||
|
|
||
| echo "Gitleaks version:" | ||
| ./gitleaks version | ||
|
|
||
| - name: Run gitleaks scan | ||
| id: gitleaks | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| mkdir -p logs | ||
|
|
||
| SCAN_ARGS=( | ||
| "git" | ||
| "--report-format" "sarif" | ||
| "--report-path" "logs/gitleaks-results.sarif" | ||
| "--redact" | ||
| "--log-level" "info" | ||
| ) | ||
|
|
||
| if [ -f ".gitleaksignore" ]; then | ||
| echo "Found .gitleaksignore — known secrets will be suppressed." | ||
| fi | ||
|
|
||
| echo "Running gitleaks scan..." | ||
| EXIT_CODE=0 | ||
| ./gitleaks "${SCAN_ARGS[@]}" || EXIT_CODE=$? | ||
|
|
||
| if [ "$EXIT_CODE" -eq 0 ]; then | ||
| echo "No secrets detected." | ||
| echo "leaks-found=false" >> "$GITHUB_OUTPUT" | ||
| elif [ "$EXIT_CODE" -eq 1 ]; then | ||
| echo "::warning::Gitleaks detected secrets in the repository." | ||
| echo "leaks-found=true" >> "$GITHUB_OUTPUT" | ||
| if [ "${{ inputs.soft-fail }}" != "true" ]; then | ||
| echo "::error::Secret scanning failed. Review detected secrets in logs/gitleaks-results.sarif" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "::error::Gitleaks encountered an unexpected error (exit code: $EXIT_CODE)" | ||
| exit "$EXIT_CODE" | ||
| fi | ||
|
|
||
| - name: Upload SARIF to Security tab | ||
| if: always() | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
|
|
||
| with: | ||
| sarif_file: logs/gitleaks-results.sarif | ||
| category: gitleaks | ||
| continue-on-error: true | ||
|
|
||
| - name: Upload scan results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
|
|
||
| with: | ||
| name: gitleaks-results | ||
| path: logs/gitleaks-results.sarif | ||
| retention-days: 90 | ||
|
|
||
| - name: Add job summary | ||
| if: always() | ||
| shell: bash | ||
| run: | | ||
| LEAKS_FOUND="${{ steps.gitleaks.outputs.leaks-found }}" | ||
| if [ "$LEAKS_FOUND" = "true" ]; then | ||
| STATUS="⚠️ Secrets Detected" | ||
| else | ||
| STATUS="✅ No Secrets Found" | ||
| fi | ||
|
|
||
| cat >> "$GITHUB_STEP_SUMMARY" <<EOF | ||
| ## Gitleaks Secret Scan Results | ||
|
|
||
| | Metric | Value | | ||
| |--------|-------| | ||
| | Status | $STATUS | | ||
|
|
||
| EOF | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.