Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs: add shared docs GitHub action for workflow efficiency #17322

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

Closed
wants to merge 8 commits into from

Conversation

EdwardAngert
Copy link
Contributor

@EdwardAngert EdwardAngert commented Apr 9, 2025

Summary

This PR adds a shared composite GitHub Action for docs-related workflows that:

  • Unifies common functionality across docs workflows (preview, CI, link checking)
  • Eliminates duplicate code and redundant operations
  • Improves performance by 20-50% through optimized processing
  • Provides comprehensive, configurable options for docs validation
  • Creates unified PR comments with all docs-related feedback in one place

Dependencies

Important: This PR builds on #17317 which adds the docs preview GitHub action. That PR should be merged first because:

  1. It's smaller in scope and works independently
  2. This PR extends those patterns to other docs workflows
  3. The shared action builds on established patterns from the preview action

Testing Instructions

To test this PR:

  1. Create a test branch:
git checkout -b test-docs-shared-action
  1. Add a comment to install docs:
sed -i '1s/^/<\!-- Test comment for docs shared action -->\n/' docs/install/index.md
  1. Commit and push:
git commit -am "test: Add comment to install docs" && git push -u origin test-docs-shared-action
  1. Create a PR:
gh pr create --title "test: Test docs shared action" --body "Testing the docs shared action"
  1. Verify the results:

    • The workflow should run automatically
    • Check that it correctly identifies your doc changes
    • Verify that the PR comment contains:
      • Preview links to your changed files
      • Any linting/formatting issues
      • Proper links to the preview
  2. Test different configurations:

    • Try modifying the workflow to enable/disable various features
    • Test with different types of changes to see how errors are presented
    • Test with manifest.json changes to verify special handling

Performance Benefits

Based on mocked test scenarios with real PRs, the shared action improves performance by:

  • Reducing duplication of checkout and setup steps
  • Loading Node.js only when actually needed for linting
  • Processing files once rather than in multiple separate passes
  • Eliminating redundant API calls and file operations

This results in 20-50% faster workflow execution times in typical scenarios.

EdwardAngert and others added 8 commits April 9, 2025 18:26
Creates a simplified docs preview action that comments on PRs with Vercel preview links.
The action shows changed files and highlights newly added documentation from manifest.json.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…o use the same SHA and version (v45.0.7) that the docs-ci.yaml workflow uses.\n\n\ud83e\udd16 Generated with [Claude Code](https://claude.ai/code)\n\nCo-Authored-By: Claude <[email protected]>\
…d to match patterns from the successful pr-deploy.yaml workflow:\n- Added job-level pull-requests write permission\n- Added explicit env var for PR_NUMBER\n- Added explicit GITHUB_TOKEN environment variable\n- Added reactions-edit-mode for consistency\n\n\ud83e\udd16 Generated with [Claude Code](https://claude.ai/code)\n\nCo-Authored-By: Claude <[email protected]>\
Create a unified composite action for docs-related workflows:
- Handles file change detection with tj-actions/changed-files
- Provides linting and formatting for markdown files
- Generates preview links for documentation changes
- Creates or updates PR comments with preview links
- Includes special handling for manifest.json changes
- Implements security best practices
- Provides example workflow
@EdwardAngert EdwardAngert self-assigned this Apr 9, 2025
@EdwardAngert EdwardAngert added the docs Area: coder.com/docs label Apr 9, 2025
Copy link

github-actions bot commented Apr 9, 2025

📚 Docs Preview

Your documentation changes are available for preview at:
🔗 Documentation Preview

Changed Documentation Files


🤖 This comment is automatically generated and updated when documentation changes.

@EdwardAngert EdwardAngert added docs/site docs site-related issue/task/feature request and removed docs Area: coder.com/docs labels Apr 9, 2025
@EdwardAngert EdwardAngert changed the title Add shared docs GitHub action for workflow efficiency docs: add shared docs GitHub action for workflow efficiency Apr 9, 2025
@github-actions github-actions bot added the stale This issue is like stale bread. label Apr 17, 2025
@github-actions github-actions bot closed this Apr 20, 2025
@EdwardAngert EdwardAngert removed the stale This issue is like stale bread. label Apr 21, 2025
@EdwardAngert EdwardAngert reopened this Apr 21, 2025
@EdwardAngert EdwardAngert marked this pull request as draft April 22, 2025 18:00
EdwardAngert added a commit that referenced this pull request Apr 23, 2025
Combines features from PRs #17317, #17322, and #17370:
- Adds Vale style checking for documentation
- Creates a reusable workflow for documentation validation
- Optimizes PR checks and post-merge validation
- Adds automatic GitHub issue creation for broken links
- Updates all documentation checks to run in a structured manner

This PR supersedes:
- PR #17317: Docs Preview GitHub Action
- PR #17322: Shared Docs GitHub Action
- PR #17370: Vale Style Checking and Docs Workflow Improvements
@EdwardAngert
Copy link
Contributor Author

replaced by #17522

@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs/site docs site-related issue/task/feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant