171 lines
5.7 KiB
YAML
171 lines
5.7 KiB
YAML
name: Audit Documentation
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
product:
|
|
description: 'Product to audit'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- core
|
|
- enterprise
|
|
- clustered
|
|
- cloud-dedicated
|
|
- all-monolith
|
|
- all-distributed
|
|
version:
|
|
description: 'Version to audit (use "local" for running containers)'
|
|
required: false
|
|
default: 'local'
|
|
create_issue:
|
|
description: 'Create GitHub issue with audit results'
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
schedule:
|
|
# Run weekly on Mondays at 9 AM UTC
|
|
# Note: This only runs API audits for distributed products
|
|
# CLI audits for core/enterprise run via the release workflow
|
|
- cron: '0 9 * * 1'
|
|
|
|
jobs:
|
|
audit-cli:
|
|
name: Audit CLI Documentation
|
|
runs-on: ubuntu-latest
|
|
# Only run for manual triggers, not scheduled runs (which are for distributed products)
|
|
if: github.event_name == 'workflow_dispatch' && contains(fromJSON('["core", "enterprise", "all-monolith"]'), github.event.inputs.product)
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
cache: 'yarn'
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Set up Docker
|
|
if: github.event.inputs.version == 'local'
|
|
run: |
|
|
docker compose up -d influxdb3-core influxdb3-enterprise
|
|
sleep 10 # Wait for containers to be ready
|
|
|
|
- name: Run CLI audit
|
|
run: |
|
|
PRODUCT="${{ github.event.inputs.product }}"
|
|
VERSION="${{ github.event.inputs.version }}"
|
|
|
|
if [ "$PRODUCT" == "all-monolith" ]; then
|
|
node ./helper-scripts/influxdb3-monolith/audit-cli-documentation.js both $VERSION
|
|
else
|
|
node ./helper-scripts/influxdb3-monolith/audit-cli-documentation.js $PRODUCT $VERSION
|
|
fi
|
|
|
|
- name: Upload CLI audit reports
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cli-audit-${{ github.event.inputs.product }}-${{ github.event.inputs.version }}
|
|
path: helper-scripts/output/cli-audit/
|
|
retention-days: 30
|
|
|
|
- name: Create CLI audit issue
|
|
if: github.event_name == 'schedule' || github.event.inputs.create_issue == 'true'
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
let product = '${{ github.event.inputs.product }}';
|
|
let version = '${{ github.event.inputs.version }}';
|
|
|
|
// Handle scheduled runs (no inputs)
|
|
if (github.event_name === 'schedule') {
|
|
product = 'both';
|
|
version = 'local';
|
|
}
|
|
|
|
// Read audit report
|
|
const reportPath = `helper-scripts/output/cli-audit/documentation-audit-${product}-${version}.md`;
|
|
|
|
if (!fs.existsSync(reportPath)) {
|
|
console.log(`Audit report not found at ${reportPath}`);
|
|
return;
|
|
}
|
|
|
|
const report = fs.readFileSync(reportPath, 'utf8');
|
|
|
|
// Create issue
|
|
await github.rest.issues.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
title: `CLI Documentation Audit - ${product} ${version}`,
|
|
body: report,
|
|
labels: ['documentation', 'cli-audit', product === 'both' ? 'core-enterprise' : product]
|
|
});
|
|
|
|
audit-api:
|
|
name: Audit API Documentation
|
|
runs-on: ubuntu-latest
|
|
if: contains(fromJSON('["clustered", "cloud-dedicated", "all-distributed"]'), github.event.inputs.product)
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run API audit
|
|
run: |
|
|
echo "API audit not yet implemented"
|
|
# TODO: Implement API documentation audit
|
|
# ./helper-scripts/influxdb3-distributed/audit-api-documentation.sh ${{ github.event.inputs.product }}
|
|
|
|
- name: Upload API audit reports
|
|
if: false # Enable when API audit is implemented
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: api-audit-${{ github.event.inputs.product }}
|
|
path: helper-scripts/output/api-audit/
|
|
retention-days: 30
|
|
|
|
summary:
|
|
name: Generate Summary Report
|
|
runs-on: ubuntu-latest
|
|
needs: [audit-cli, audit-api]
|
|
if: always()
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: audit-artifacts/
|
|
|
|
- name: Generate summary
|
|
run: |
|
|
echo "# Documentation Audit Summary" > summary.md
|
|
echo "Date: $(date)" >> summary.md
|
|
echo "Product: ${{ github.event.inputs.product }}" >> summary.md
|
|
echo "Version: ${{ github.event.inputs.version }}" >> summary.md
|
|
echo "" >> summary.md
|
|
|
|
# Add CLI audit results if available
|
|
if [ -d "audit-artifacts/cli-audit-*" ]; then
|
|
echo "## CLI Audit Results" >> summary.md
|
|
cat audit-artifacts/cli-audit-*/*.md >> summary.md
|
|
fi
|
|
|
|
# Add API audit results if available
|
|
if [ -d "audit-artifacts/api-audit-*" ]; then
|
|
echo "## API Audit Results" >> summary.md
|
|
cat audit-artifacts/api-audit-*/*.md >> summary.md
|
|
fi
|
|
|
|
- name: Upload summary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: audit-summary
|
|
path: summary.md
|
|
retention-days: 30 |