Skip to content

Commit c740602

Browse files
committed
chore(ci): Audit documentation for changes to influxdb3 CLI. Configures a GitHub release workflow to generate release notes and run the audit documentation script.
1 parent 9a4721a commit c740602

File tree

7 files changed

+1605
-323
lines changed

7 files changed

+1605
-323
lines changed

.github/workflows/audit-documentation.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,37 @@ on:
1818
description: 'Version to audit (use "local" for running containers)'
1919
required: false
2020
default: 'local'
21+
create_issue:
22+
description: 'Create GitHub issue with audit results'
23+
required: false
24+
type: boolean
25+
default: false
2126

2227
schedule:
2328
# Run weekly on Mondays at 9 AM UTC
29+
# Note: This only runs API audits for distributed products
30+
# CLI audits for core/enterprise run via the release workflow
2431
- cron: '0 9 * * 1'
2532

2633
jobs:
2734
audit-cli:
2835
name: Audit CLI Documentation
2936
runs-on: ubuntu-latest
30-
if: contains(fromJSON('["core", "enterprise", "all-monolith"]'), github.event.inputs.product)
37+
# Only run for manual triggers, not scheduled runs (which are for distributed products)
38+
if: github.event_name == 'workflow_dispatch' && contains(fromJSON('["core", "enterprise", "all-monolith"]'), github.event.inputs.product)
3139

3240
steps:
3341
- uses: actions/checkout@v4
3442

43+
- name: Set up Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: '18'
47+
cache: 'yarn'
48+
49+
- name: Install dependencies
50+
run: yarn install --frozen-lockfile
51+
3552
- name: Set up Docker
3653
if: github.event.inputs.version == 'local'
3754
run: |
@@ -44,9 +61,9 @@ jobs:
4461
VERSION="${{ github.event.inputs.version }}"
4562
4663
if [ "$PRODUCT" == "all-monolith" ]; then
47-
./helper-scripts/influxdb3-monolith/audit-cli-documentation.sh both $VERSION
64+
node ./helper-scripts/influxdb3-monolith/audit-cli-documentation.js both $VERSION
4865
else
49-
./helper-scripts/influxdb3-monolith/audit-cli-documentation.sh $PRODUCT $VERSION
66+
node ./helper-scripts/influxdb3-monolith/audit-cli-documentation.js $PRODUCT $VERSION
5067
fi
5168
5269
- name: Upload CLI audit reports
@@ -62,11 +79,23 @@ jobs:
6279
with:
6380
script: |
6481
const fs = require('fs');
65-
const product = '${{ github.event.inputs.product }}';
66-
const version = '${{ github.event.inputs.version }}';
82+
let product = '${{ github.event.inputs.product }}';
83+
let version = '${{ github.event.inputs.version }}';
84+
85+
// Handle scheduled runs (no inputs)
86+
if (github.event_name === 'schedule') {
87+
product = 'both';
88+
version = 'local';
89+
}
6790
6891
// Read audit report
6992
const reportPath = `helper-scripts/output/cli-audit/documentation-audit-${product}-${version}.md`;
93+
94+
if (!fs.existsSync(reportPath)) {
95+
console.log(`Audit report not found at ${reportPath}`);
96+
return;
97+
}
98+
7099
const report = fs.readFileSync(reportPath, 'utf8');
71100
72101
// Create issue
@@ -75,7 +104,7 @@ jobs:
75104
repo: context.repo.repo,
76105
title: `CLI Documentation Audit - ${product} ${version}`,
77106
body: report,
78-
labels: ['documentation', 'cli-audit', product]
107+
labels: ['documentation', 'cli-audit', product === 'both' ? 'core-enterprise' : product]
79108
});
80109
81110
audit-api:
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
name: InfluxDB 3 Release Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
product:
7+
description: 'Product being released'
8+
required: true
9+
type: choice
10+
options:
11+
- core
12+
- enterprise
13+
- both
14+
version:
15+
description: 'Version being released (e.g., 3.0.0)'
16+
required: true
17+
type: string
18+
previous_version:
19+
description: 'Previous version for comparison (e.g., 2.9.0)'
20+
required: true
21+
type: string
22+
dry_run:
23+
description: 'Dry run (do not create PRs or issues)'
24+
required: false
25+
type: boolean
26+
default: true
27+
28+
jobs:
29+
generate-release-notes:
30+
name: Generate Release Notes
31+
runs-on: ubuntu-latest
32+
outputs:
33+
release_notes_generated: ${{ steps.generate.outputs.generated }}
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: '18'
42+
cache: 'yarn'
43+
44+
- name: Install dependencies
45+
run: yarn install --frozen-lockfile
46+
47+
- name: Generate release notes
48+
id: generate
49+
run: |
50+
echo "Generating release notes for ${{ github.event.inputs.product }} v${{ github.event.inputs.version }}"
51+
52+
# TODO: Call the actual generate-release-notes script when it exists
53+
# node ./helper-scripts/influxdb3-monolith/generate-release-notes.js \
54+
# --product ${{ github.event.inputs.product }} \
55+
# --version ${{ github.event.inputs.version }} \
56+
# --previous ${{ github.event.inputs.previous_version }}
57+
58+
# For now, create a placeholder
59+
mkdir -p helper-scripts/output/release-notes
60+
echo "# Release Notes for ${{ github.event.inputs.product }} v${{ github.event.inputs.version }}" > helper-scripts/output/release-notes/release-notes-${{ github.event.inputs.product }}-${{ github.event.inputs.version }}.md
61+
echo "Generated: true" >> $GITHUB_OUTPUT
62+
63+
- name: Upload release notes
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: release-notes-${{ github.event.inputs.product }}-${{ github.event.inputs.version }}
67+
path: helper-scripts/output/release-notes/
68+
retention-days: 30
69+
70+
audit-cli-documentation:
71+
name: Audit CLI Documentation
72+
needs: generate-release-notes
73+
runs-on: ubuntu-latest
74+
if: needs.generate-release-notes.outputs.release_notes_generated == 'true'
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Set up Node.js
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: '18'
83+
cache: 'yarn'
84+
85+
- name: Install dependencies
86+
run: yarn install --frozen-lockfile
87+
88+
- name: Pull Docker images for version
89+
run: |
90+
VERSION="${{ github.event.inputs.version }}"
91+
PRODUCT="${{ github.event.inputs.product }}"
92+
93+
if [ "$PRODUCT" == "both" ]; then
94+
docker pull influxdb:${VERSION}-core || true
95+
docker pull influxdb:${VERSION}-enterprise || true
96+
else
97+
docker pull influxdb:${VERSION}-${PRODUCT} || true
98+
fi
99+
100+
- name: Run CLI audit
101+
run: |
102+
PRODUCT="${{ github.event.inputs.product }}"
103+
VERSION="${{ github.event.inputs.version }}"
104+
105+
node ./helper-scripts/influxdb3-monolith/audit-cli-documentation.js $PRODUCT $VERSION
106+
107+
- name: Upload CLI audit reports
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: cli-audit-release-${{ github.event.inputs.product }}-${{ github.event.inputs.version }}
111+
path: helper-scripts/output/cli-audit/
112+
retention-days: 90
113+
114+
create-documentation-pr:
115+
name: Create Documentation PR
116+
needs: [generate-release-notes, audit-cli-documentation]
117+
runs-on: ubuntu-latest
118+
if: github.event.inputs.dry_run != 'true'
119+
120+
steps:
121+
- uses: actions/checkout@v4
122+
123+
- name: Download artifacts
124+
uses: actions/download-artifact@v4
125+
with:
126+
path: artifacts/
127+
128+
- name: Create release branch
129+
run: |
130+
BRANCH="release-docs-${{ github.event.inputs.product }}-${{ github.event.inputs.version }}"
131+
git checkout -b $BRANCH
132+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
133+
134+
- name: Copy release notes to docs
135+
run: |
136+
# TODO: Copy release notes to appropriate documentation location
137+
echo "Release notes would be copied here"
138+
139+
- name: Create Pull Request
140+
uses: peter-evans/create-pull-request@v5
141+
with:
142+
token: ${{ secrets.GITHUB_TOKEN }}
143+
branch: ${{ env.BRANCH }}
144+
title: "docs: Release documentation for ${{ github.event.inputs.product }} v${{ github.event.inputs.version }}"
145+
body: |
146+
## Release Documentation Update
147+
148+
This PR contains documentation updates for **${{ github.event.inputs.product }} v${{ github.event.inputs.version }}**
149+
150+
### Included Updates:
151+
- [ ] Release notes
152+
- [ ] Version updates
153+
- [ ] CLI documentation audit results
154+
155+
### Artifacts:
156+
- [Release Notes](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
157+
- [CLI Audit Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
158+
159+
### Manual Review Needed:
160+
Please review the CLI audit report for any missing or outdated documentation that needs to be updated.
161+
162+
---
163+
*This PR was automatically generated by the release workflow.*
164+
labels: |
165+
documentation
166+
release
167+
${{ github.event.inputs.product }}
168+
draft: true
169+
170+
create-audit-issue:
171+
name: Create CLI Audit Issue
172+
needs: audit-cli-documentation
173+
runs-on: ubuntu-latest
174+
if: github.event.inputs.dry_run != 'true'
175+
176+
steps:
177+
- uses: actions/checkout@v4
178+
179+
- name: Download audit report
180+
uses: actions/download-artifact@v4
181+
with:
182+
name: cli-audit-release-${{ github.event.inputs.product }}-${{ github.event.inputs.version }}
183+
path: audit-report/
184+
185+
- name: Create issue from audit
186+
uses: actions/github-script@v7
187+
with:
188+
script: |
189+
const fs = require('fs');
190+
const product = '${{ github.event.inputs.product }}';
191+
const version = '${{ github.event.inputs.version }}';
192+
193+
// Find and read the audit report
194+
const files = fs.readdirSync('audit-report');
195+
const auditFile = files.find(f => f.includes('documentation-audit'));
196+
197+
if (!auditFile) {
198+
console.log('No audit report found');
199+
return;
200+
}
201+
202+
const report = fs.readFileSync(`audit-report/${auditFile}`, 'utf8');
203+
204+
// Check if there are any issues to report
205+
const hasMissingOptions = report.includes('⚠️ Missing from docs');
206+
const hasExtraOptions = report.includes('ℹ️ Documented but not in CLI');
207+
208+
if (hasMissingOptions || hasExtraOptions) {
209+
// Create issue
210+
await github.rest.issues.create({
211+
owner: context.repo.owner,
212+
repo: context.repo.repo,
213+
title: `CLI Documentation Updates Needed - ${product} v${version}`,
214+
body: `## CLI Documentation Audit Results
215+
216+
The following documentation issues were found during the release of **${product} v${version}**:
217+
218+
${report}
219+
220+
### Action Items:
221+
- [ ] Review and update documentation for commands with missing options
222+
- [ ] Remove documentation for deprecated options
223+
- [ ] Verify all examples work with the new version
224+
- [ ] Update any version-specific content
225+
226+
---
227+
*This issue was automatically generated during the release process.*`,
228+
labels: ['documentation', 'cli-audit', 'release', product],
229+
milestone: version // Assumes milestone exists for version
230+
});
231+
232+
console.log('Created issue for CLI documentation updates');
233+
} else {
234+
console.log('No documentation issues found - skipping issue creation');
235+
}
236+
237+
summary:
238+
name: Release Summary
239+
needs: [generate-release-notes, audit-cli-documentation, create-documentation-pr, create-audit-issue]
240+
runs-on: ubuntu-latest
241+
if: always()
242+
243+
steps:
244+
- name: Generate summary
245+
run: |
246+
echo "# Release Documentation Summary" >> $GITHUB_STEP_SUMMARY
247+
echo "" >> $GITHUB_STEP_SUMMARY
248+
echo "## Release Information" >> $GITHUB_STEP_SUMMARY
249+
echo "- **Product**: ${{ github.event.inputs.product }}" >> $GITHUB_STEP_SUMMARY
250+
echo "- **Version**: ${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY
251+
echo "- **Previous Version**: ${{ github.event.inputs.previous_version }}" >> $GITHUB_STEP_SUMMARY
252+
echo "- **Dry Run**: ${{ github.event.inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
253+
echo "" >> $GITHUB_STEP_SUMMARY
254+
255+
echo "## Workflow Results" >> $GITHUB_STEP_SUMMARY
256+
echo "| Step | Status |" >> $GITHUB_STEP_SUMMARY
257+
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
258+
echo "| Generate Release Notes | ${{ needs.generate-release-notes.result }} |" >> $GITHUB_STEP_SUMMARY
259+
echo "| CLI Documentation Audit | ${{ needs.audit-cli-documentation.result }} |" >> $GITHUB_STEP_SUMMARY
260+
echo "| Create Documentation PR | ${{ needs.create-documentation-pr.result }} |" >> $GITHUB_STEP_SUMMARY
261+
echo "| Create Audit Issue | ${{ needs.create-audit-issue.result }} |" >> $GITHUB_STEP_SUMMARY
262+
echo "" >> $GITHUB_STEP_SUMMARY
263+
264+
if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then
265+
echo "**Note**: This was a dry run. No PRs or issues were created." >> $GITHUB_STEP_SUMMARY
266+
fi

0 commit comments

Comments
 (0)