-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add automated documentation sync reminders and template improve… #26
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
base: main
Are you sure you want to change the base?
feat: add automated documentation sync reminders and template improve… #26
Conversation
…ments - Add GitHub Actions workflow to detect README changes and create sync reminders - Update README_TEMPLATE.md with documentation sync instructions - Add validate_readme.py script for template compliance checking - Update CONTRIBUTING.md with comprehensive documentation sync process guide The workflow automatically: - Detects plugin README changes on master branch commits - Creates commit comments with pre-filled sync request links to docs-v2 - Provides clear instructions for the sync process - Requires no secrets or cross-repository authentication Updated documentation includes: - Complete sync workflow instructions - Template compliance requirements - Automated sync process explanation - Manual sync alternatives
…ers, move to scripts directory:- Moves validate_readme.py to /scripts - Replaces magic numbers with variables - Adds support for --help and --list flags- Updates contributing doc
3bc228e
to
cf7a557
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an automated documentation sync system to remind contributors to synchronize plugin README changes with the InfluxDB documentation site. The workflow automatically detects when plugin READMEs are modified and provides clear instructions for syncing those changes to the docs-v2 repository.
Key changes:
- Automated detection and reminder system for README changes via GitHub Actions
- Comprehensive README template with sync instructions and validation requirements
- Python validation script to ensure README compliance with template standards
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
.github/workflows/remind-sync-docs.yml |
GitHub Actions workflow that detects README changes and creates sync reminder comments |
README_TEMPLATE.md |
Comprehensive template for plugin READMEs with sync instructions and proper structure |
CONTRIBUTING.md |
Updated with detailed documentation sync process and requirements |
scripts/validate_readme.py |
Python script for validating README compliance against template standards |
Comments suppressed due to low confidence (1)
errors = [] | ||
|
||
# Check for bash code examples | ||
bash_examples = re.findall(r'```bash(.*?)```', content, re.DOTALL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern for finding bash examples may match incorrectly if there are nested backticks or escaped characters within code blocks. Consider using a more robust parsing approach or adding boundary checks to avoid false matches.
bash_examples = re.findall(r'```bash(.*?)```', content, re.DOTALL) | |
bash_examples = [] | |
in_bash_block = False | |
current_block = [] | |
for line in content.splitlines(): | |
if not in_bash_block and line.strip().startswith("```bash"): | |
in_bash_block = True | |
current_block = [] | |
# If there is content after ```bash on the same line, include it | |
after = line.strip()[7:] | |
if after: | |
current_block.append(after) | |
elif in_bash_block and line.strip().startswith("```"): | |
in_bash_block = False | |
bash_examples.append('\n'.join(current_block)) | |
elif in_bash_block: | |
current_block.append(line) |
Copilot uses AI. Check for mistakes.
|
||
# Check for emoji metadata pattern | ||
metadata_pattern = r'^⚡\s+[\w\-,\s]+\s+🏷️\s+[\w\-,\s]+\s+🔧\s+InfluxDB 3' | ||
if not re.search(metadata_pattern, content, re.MULTILINE): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded regex pattern for emoji metadata validation is fragile and difficult to maintain. Consider extracting the pattern to a constant or configuration, and document the expected format more clearly to make future updates easier.
if not re.search(metadata_pattern, content, re.MULTILINE): | |
# Emoji metadata line format: | |
# The README must contain a line matching the following format: | |
# ⚡ <trigger types> 🏷️ <tags> 🔧 InfluxDB 3 | |
# - ⚡: Indicates trigger types (comma-separated, e.g., "scheduled, webhook") | |
# - 🏷️: Indicates tags (comma-separated, e.g., "data, analytics") | |
# - 🔧: Indicates compatibility (always "InfluxDB 3" for now) | |
EMOJI_METADATA_PATTERN = r'^⚡\s+[\w\-,\s]+\s+🏷️\s+[\w\-,\s]+\s+🔧\s+InfluxDB 3' | |
def validate_emoji_metadata(content: str) -> List[str]: | |
"""Validate the emoji metadata line.""" | |
errors = [] | |
# Check for emoji metadata pattern | |
if not re.search(EMOJI_METADATA_PATTERN, content, re.MULTILINE): |
Copilot uses AI. Check for mistakes.
|
||
# Check for template remnants | ||
if 'Plugin Name' in content and '# Plugin Name' in content: | ||
errors.append("README still contains template placeholder 'Plugin Name'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks for both 'Plugin Name' and '# Plugin Name' which is redundant since the second check is more specific and would be sufficient. Consider simplifying to just check for '# Plugin Name' to avoid duplicate validation logic.
errors.append("README still contains template placeholder 'Plugin Name'") | |
if '# Plugin Name' in content: | |
errors.append("README still contains template placeholder '# Plugin Name'") |
Copilot uses AI. Check for mistakes.
id: detect-changes | ||
run: | | ||
# Get list of changed README files | ||
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^influxdata/.*/README\.md$' | head -10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The head -10
limitation arbitrarily caps the number of changed files processed. If more than 10 plugin READMEs are changed in a single commit, some changes won't trigger sync reminders. Consider either removing this limit or making it configurable.
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^influxdata/.*/README\.md$' | head -10) | |
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^influxdata/.*/README\.md$') |
Copilot uses AI. Check for mistakes.
…ments
The workflow automatically:
Updated documentation includes:
This workflow works with influxdata/docs-v2#6329 to sync updated READMEs in influxdb3_plugins to influxdata/docs-v2.