Skip to content
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

Auto docs action added to pull-request.yml #2716

Closed
wants to merge 10 commits into from

Conversation

hars-21
Copy link

@hars-21 hars-21 commented Jan 24, 2025

What kind of change does this PR introduce?

Feature

Issue Number:

Fixes #2678

Did you add tests for your changes?

  • Tests are written for all changes made in this PR.
  • Test coverage meets or exceeds the current coverage (~90/95%).

Snapshots/Videos:

If relevant, did you update the documentation?

Added auto generated docs under docs/docs/auto-docs

Summary

Added auto generated docs using github actions
Uses python script to convert html to markdown file

Does this PR introduce a breaking change?

no

Checklist for Repository Standards

  • Have you reviewed and implemented all applicable coderaabbitai review suggestions?
  • Have you ensured that the PR aligns with the repository’s contribution guidelines?

Other information

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Added a new GitHub workflow job to automatically generate and convert documentation
    • Introduced a Python script to convert HTML documentation files to Markdown format
  • Chores

    • Updated GitHub Actions workflow configuration
    • Improved documentation generation process

Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Walkthrough

This pull request introduces a new Python script .github/workflows/convert_html_to_md.py designed to convert HTML files to Markdown format. The script is specifically configured to process HTML files from the 'docs/temp-docs' directory and generate corresponding Markdown files in the 'docs/docs/auto-docs' directory. It uses the markdownify library to perform the conversion, ensuring a systematic approach to transforming documentation files while maintaining the original directory structure.

Changes

File Change Summary
.github/workflows/convert_html_to_md.py New script added to convert HTML files to Markdown
.github/workflows/pull-request.yml Added generate-docs job, updated workflow configurations, modified dependency and build commands

Assessment against linked issues

Objective Addressed Explanation
Move autogenerated files to docs/auto-docs
Modify workflow to create updated markdown
Add autogenerated files under Developer Guide/Reference Menu structure not explicitly defined in this PR

Possibly related PRs

Suggested labels

ignore-sensitive-files-pr

Suggested reviewers

  • noman2002
  • palisadoes

Poem

🐰 In bytes of HTML, a rabbit's delight,
Markdown emerges, converting with might!
From temp to docs, files dance and sway,
A script that transforms, hip-hip-hooray!
CodeRabbit's magic, documentation's new flight! 🌈

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

Other

🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.80%. Comparing base (0b34401) to head (f87b50c).
Report is 2 commits behind head on develop-postgres.

Additional details and impacted files
@@                 Coverage Diff                  @@
##           develop-postgres    #2716      +/-   ##
====================================================
+ Coverage             96.55%   96.80%   +0.25%     
====================================================
  Files                   189      189              
  Lines                  9994     9997       +3     
====================================================
+ Hits                   9650     9678      +28     
+ Misses                  344      319      -25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
.github/workflows/convert_html_to_md.py (2)

13-13: Rename the unused loop variable.

The loop variable dirs is never used. Consider renaming it to _ or _dirs to make its unused status explicit and avoid static analysis warnings.

 for root, dirs, files in os.walk(input_path):
-    # ...
+for root, _dirs, files in os.walk(input_path):
     # ...
🧰 Tools
🪛 Ruff (0.8.2)

13-13: Loop control variable dirs not used within loop body

Rename unused dirs to _dirs

(B007)


11-35: Consider adding unit tests or integration tests for this new script.

This script introduces a key functionality for automated documentation generation. Tests would ensure consistent behavior and help catch regressions.

Do you want me to propose a basic test suite template that validates the conversion logic?

🧰 Tools
🪛 Ruff (0.8.2)

13-13: Loop control variable dirs not used within loop body

Rename unused dirs to _dirs

(B007)

.github/workflows/pull-request.yml (1)

206-272: Excellent addition of the generate-docs job.

This job neatly integrates your new Python script into the workflow, ensuring docs are generated and committed. Consider adding a dry-run or a separate action that verifies the generated Markdown to catch formatting issues early.

🧰 Tools
🪛 actionlint (1.7.4)

239-239: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


266-266: "github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details

(expression)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a144878 and f87b50c.

📒 Files selected for processing (2)
  • .github/workflows/convert_html_to_md.py (1 hunks)
  • .github/workflows/pull-request.yml (4 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
.github/workflows/convert_html_to_md.py

13-13: Loop control variable dirs not used within loop body

Rename unused dirs to _dirs

(B007)

🪛 actionlint (1.7.4)
.github/workflows/pull-request.yml

239-239: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


266-266: "github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details

(expression)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Generate documentation
  • GitHub Check: Checking codebase
🔇 Additional comments (3)
.github/workflows/pull-request.yml (3)

16-16: No concerns.

Ignoring the master branch for pull requests is a common practice in many repositories that use a different long-lived branch (like develop-postgres).


36-41: String formatting changes are consistent.

The switch to double-quoted strings is consistent with modern best practices and fosters uniformity across the code.


310-327: Node version and build steps appear consistent.

The updates to use Node.js 20.x and npm for building the Docusaurus docs are aligned with best practices. Verify any known compatibility issues with existing code or dependencies.

rm -rf docs/temp-docs

- name: Commit and push changes
run: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid using untrusted expressions directly in inline script arguments.

github.event.pull_request.head.ref may be untrusted. Per GitHub security guides, you can safely pass it via an environment variable, then reference that variable in scripts.

- git push origin HEAD:${{ github.event.pull_request.head.ref }}
+ export PR_HEAD_REF="${{ github.event.pull_request.head.ref }}"
+ git push origin HEAD:"${PR_HEAD_REF}"

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint (1.7.4)

266-266: "github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details

(expression)

sdk: "3.4.4"

- name: Set up Python
uses: actions/setup-python@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update actions/setup-python@v4 to v5 for version consistency

The runner compatibility is not an issue, but the workflow uses two different versions of setup-python (v4 and v5). Update to v5 to maintain consistency and use the latest stable version.

  • Line 239: uses: actions/setup-python@v4uses: actions/setup-python@v5
🔗 Analysis chain

Update the runner for actions/setup-python@v4.

Static analysis suggests the current runner might be too old. Consider upgrading or verifying that your workflow environment supports the specified version.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Review the available runners for 'actions/setup-python' in your GitHub Actions environment.
# Expected outcome: Confirm that 'actions/setup-python@v4' is fully supported on your runner.

gh run list --limit 10

Length of output: 1515


Script:

#!/bin/bash
# Check the workflow file for runner configuration
cat .github/workflows/pull-request.yml

# Check the latest version of actions/setup-python
curl -s https://api.github.com/repos/actions/setup-python/releases | jq -r '.[0].tag_name'

Length of output: 13056

🧰 Tools
🪛 actionlint (1.7.4)

239-239: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

@hars-21
Copy link
Author

hars-21 commented Jan 24, 2025

Sir when I ran this script on my branch it successfully generated the docs in auto-docs folder but here it is failing and stating permission denied.

image

Sir can you please help me find a solution to this problem. Also, this is the PR on my branch where it was successful: hars-21#3

@palisadoes
Copy link
Contributor

  1. We have had really big issues with Github and doing this in GitHub actions.
  2. This will need to be a pre-commit action.
  3. Divyanshu should have sent you a slack message about this. Please work on the solution in slack

@gautam-divyanshu PTAL

@hars-21 hars-21 closed this Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants