-
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
Open
jstirnaman
wants to merge
8
commits into
main
Choose a base branch
from
jstirnaman/validate-and-sync-readmes-with-influxdata-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
18e9f7d
feat: add automated documentation sync reminders and template improve…
jstirnaman cf7a557
docs: Improve validations: add validate_readme --help, fix magic numb…
jstirnaman bf5cd15
fix: update workflow to trigger on main branch instead of master
MeelahMe a4bd405
fix: improve validation and fix workflow branch trigger
MeelahMe 7ccdab5
Merge branch 'main' into jstirnaman/validate-and-sync-readmes-with-in…
MeelahMe ff44a08
fix: eliminate validation false positives with robust section extraction
MeelahMe de990ae
fix: remove arbitrary 10-file limit from README change detection
MeelahMe 3c2bc22
refactor: address code quality feedback from Copilot review
MeelahMe 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,122 @@ | ||
name: Remind to Sync Documentation | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'influxdata/**/README.md' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
remind-sync: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 # Need previous commit to detect changes | ||
|
||
- name: Detect changed plugins | ||
id: detect-changes | ||
run: | | ||
# Get list of changed README files | ||
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^influxdata/.*/README\.md$') | ||
|
||
if [[ -z "$CHANGED_FILES" ]]; then | ||
echo "No plugin README files changed" | ||
echo "changed_plugins=" >> $GITHUB_OUTPUT | ||
echo "has_changes=false" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
|
||
echo "Changed files:" | ||
echo "$CHANGED_FILES" | ||
|
||
# Extract plugin names from file paths | ||
PLUGIN_NAMES="" | ||
while IFS= read -r file; do | ||
if [[ -n "$file" ]]; then | ||
# Extract plugin name from path: influxdata/plugin_name/README.md -> plugin_name | ||
PLUGIN_NAME=$(echo "$file" | sed 's|influxdata/||' | sed 's|/README\.md||') | ||
if [[ -n "$PLUGIN_NAMES" ]]; then | ||
PLUGIN_NAMES="$PLUGIN_NAMES, $PLUGIN_NAME" | ||
else | ||
PLUGIN_NAMES="$PLUGIN_NAME" | ||
fi | ||
fi | ||
done <<< "$CHANGED_FILES" | ||
|
||
echo "Changed plugins: $PLUGIN_NAMES" | ||
echo "changed_plugins=$PLUGIN_NAMES" >> $GITHUB_OUTPUT | ||
echo "has_changes=true" >> $GITHUB_OUTPUT | ||
|
||
- name: Create sync reminder comment | ||
if: steps.detect-changes.outputs.has_changes == 'true' | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const changedPlugins = '${{ steps.detect-changes.outputs.changed_plugins }}'; | ||
const commitSha = context.sha; | ||
const shortSha = commitSha.substring(0, 7); | ||
|
||
// Build the GitHub issue URL with pre-filled parameters | ||
const baseUrl = 'https://github.com/influxdata/docs-v2/issues/new'; | ||
const template = 'sync-plugin-docs.yml'; | ||
const title = encodeURIComponent(`Sync plugin docs: ${changedPlugins}`); | ||
const plugins = encodeURIComponent(changedPlugins); | ||
const sourceCommit = encodeURIComponent(commitSha); | ||
|
||
const issueUrl = `${baseUrl}?template=${template}&title=${title}&plugins=${plugins}&source_commit=${sourceCommit}`; | ||
|
||
// Create the comment body | ||
const commentBody = `📚 **Plugin documentation updated!** | ||
|
||
The following plugin READMEs were changed in this commit: | ||
**${changedPlugins}** | ||
|
||
## Next Steps | ||
|
||
To sync these changes to the InfluxDB documentation site: | ||
|
||
### 🚀 [**Click here to create sync request**](${issueUrl}) | ||
|
||
This will open a pre-filled issue in docs-v2 that will automatically trigger the sync workflow. | ||
|
||
### What the sync process does: | ||
1. ✅ Validates your plugin READMEs against template requirements | ||
2. 🔄 Transforms content for docs-v2 compatibility (adds Hugo shortcodes, fixes links) | ||
3. 🖼️ Generates screenshots of the plugin documentation pages | ||
4. 📝 Creates a pull request in docs-v2 ready for review | ||
|
||
### Before syncing: | ||
- Ensure your README follows the [README_TEMPLATE.md](https://github.com/influxdata/influxdb3_plugins/blob/master/README_TEMPLATE.md) structure | ||
- Include proper emoji metadata (⚡ triggers, 🏷️ tags, 🔧 compatibility) | ||
- Verify all required sections are present and complete | ||
|
||
--- | ||
*Commit: ${shortSha} | [View workflow](https://github.com/influxdata/docs-v2/blob/master/helper-scripts/influxdb3-plugins/README.md)*`; | ||
|
||
// Create commit comment | ||
await github.rest.repos.createCommitComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
commit_sha: commitSha, | ||
body: commentBody | ||
}); | ||
|
||
console.log(`Created sync reminder for plugins: ${changedPlugins}`); | ||
console.log(`Issue URL: ${issueUrl}`); | ||
|
||
- name: Log workflow completion | ||
if: steps.detect-changes.outputs.has_changes == 'true' | ||
run: | | ||
echo "✅ Sync reminder created for plugins: ${{ steps.detect-changes.outputs.changed_plugins }}" | ||
echo "🔗 Users can click the link in the commit comment to trigger docs sync" | ||
|
||
- name: No changes detected | ||
if: steps.detect-changes.outputs.has_changes == 'false' | ||
run: | | ||
echo "ℹ️ No plugin README files were changed in this commit" |
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
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.