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

Added Auto docs using Github Action #2713

Closed

Conversation

hars-21
Copy link

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

What kind of change does this PR introduce?

Issue Number:

Fixes #2678

Did you add tests for your changes?

No

  • 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?

Docs can be found here: /docs/docs/auto-docs

Summary

Added auto generated docs for talawa-mobile docs

Does this PR introduce a breaking change?

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

  • Workflow Updates

    • Added a new documentation generation job to enhance workflow capabilities.
    • Updated Node.js version in the Docusaurus deployment job.
    • Standardized string formatting by replacing single quotes with double quotes in workflow configuration.
  • Documentation

    • Introduced a new script for automatic Dart documentation generation.
    • Configured documentation output to a specified directory.

Copy link
Contributor

coderabbitai bot commented Jan 21, 2025

Warning

Rate limit exceeded

@hars-21 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1792768 and 97f81c5.

📒 Files selected for processing (2)
  • .github/workflows/pull-request.yml (4 hunks)
  • docs/package.json (1 hunks)

Walkthrough

The pull request introduces modifications to the GitHub Actions workflow and documentation configuration. A new job generate-docs is added to the .github/workflows/pull-request.yml file, specifically targeting the TALAWA_ENVIRONMENT. This job focuses on generating documentation for Dart, Flutter, and Java projects, with a defined workflow to check out the repository, set up development environments, generate documentation, and potentially commit and push updates.

Changes

File Change Summary
.github/workflows/pull-request.yml - Added new generate-docs job
- Updated string formatting (single to double quotes)
- Modified Test-Docusaurus-Deployment job (Node.js version, package manager)
docs/package.json - Added new script "generate-docs" for documentation generation

Assessment against linked issues

Objective Addressed Explanation
Autogenerate documentation [#2678]
Move autogenerated files to docs/auto-docs [#2678]
Modify workflow for documentation generation [#2678]

Possibly related PRs

Suggested labels

ignore-sensitive-files-pr

Poem

🐰 Docs dancing, workflows sing,
Code's secrets take their wing!
Dart and Flutter, Java's might,
Documentation shining bright!
A rabbit's code, a GitHub delight! 🌟


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

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

@palisadoes
Copy link
Contributor

  1. Please work with @gautam-divyanshu and @tasneemkoushar on approving this PR
  2. They have extensive experience with this. GitHub actions don't seem to work any more in this use case

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: 5

🧹 Nitpick comments (2)
.github/workflows/pull-request.yml (2)

143-151: Fix shell script quoting in documentation check

The script has potential word splitting issues as flagged by shellcheck.

Add proper quoting:

       - name: Check for Doc Updates
         id: DocUpdated
         run: |
-          if [ -n "$(git status --porcelain docs/docs/auto-docs)" ]; then
+          if [ -n "$(git status --porcelain "docs/docs/auto-docs")" ]; then
             echo "updateDoc=true" >> $GITHUB_OUTPUT
             echo "Documentation has been updated!"
           else
             echo "No documentation updates found."
           fi
🧰 Tools
🪛 actionlint (1.7.4)

145-145: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)


154-161: Improve documentation commit process

The current implementation might create empty commits or fail if there are no changes.

Add better error handling and commit message:

       - name: Commit and Push Docs
         if: steps.DocUpdated.outputs.updateDoc
         run: |
           git config user.name "${{ github.actor }}"
           git config user.email "${{ github.actor }}@users.noreply.github.com"
-          git add docs/docs/auto-docs
-          git commit -m "Update auto-generated documentation"
-          git push
+          git add "docs/docs/auto-docs"
+          git commit -m "docs: update auto-generated documentation [skip ci]
+          
+          - Updated Dart/Flutter documentation
+          - Updated Java documentation
+          
+          Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
+          git push || echo "::error::Failed to push documentation updates"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b34401 and 7cd1b0a.

📒 Files selected for processing (2)
  • .github/workflows/pull-request.yml (4 hunks)
  • docs/package.json (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pull-request.yml

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

(action)


145-145: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Checking codebase

docs/package.json Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
@hars-21 hars-21 had a problem deploying to TALAWA_ENVIRONMENT January 21, 2025 17:31 — with GitHub Actions Failure
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: 1

♻️ Duplicate comments (3)
.github/workflows/pull-request.yml (3)

108-111: ⚠️ Potential issue

Update actions/setup-java to latest version

The current version is outdated and may have security vulnerabilities.

🧰 Tools
🪛 actionlint (1.7.4)

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

(action)


126-135: 🛠️ Refactor suggestion

Improve Dart documentation generation

The implementation needs optimization for better efficiency and configuration.


136-140: ⚠️ Potential issue

Fix Java documentation generation

The command needs to be updated to match the project structure.

🧹 Nitpick comments (3)
.github/workflows/pull-request.yml (3)

152-160: Enhance commit message and add error handling

The commit message could be more descriptive, and the push operation needs error handling.

Apply these improvements:

 - name: Commit and Push Docs
   if: steps.DocUpdated.outputs.updateDoc
   run: |
     git config user.name "${{ github.actor }}"
     git config user.email "${{ github.actor }}@users.noreply.github.com"
     git add docs/docs/auto-docs
-    git commit -m "Update auto-generated documentation"
-    git push
+    git commit -m "docs: update auto-generated documentation for Dart, Flutter, and Java [skip ci]"
+    if ! git push; then
+      echo "Failed to push changes. Retrying with pull and rebase..."
+      git pull --rebase
+      git push
+    fi

308-308: Improve job condition precision

The current condition could be more specific about the branch requirements.

Update the condition:

-    if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop-postgres' }}
+    if: |
+      github.actor != 'dependabot[bot]' &&
+      github.event.pull_request.base.ref == 'develop-postgres' &&
+      !contains(github.event.pull_request.labels.*.name, 'skip-docs')

314-323: Add caching for Node.js dependencies

Adding cache for node_modules will improve workflow execution time.

Add caching step:

 - name: Set up Node.js
   uses: actions/setup-node@v4
   with:
     node-version: "20.x"
+    cache: 'npm'
+    cache-dependency-path: './docs/package-lock.json'

+- name: Cache node_modules
+  uses: actions/cache@v3
+  with:
+    path: ./docs/node_modules
+    key: ${{ runner.os }}-node-${{ hashFiles('./docs/package-lock.json') }}
+    restore-keys: |
+      ${{ runner.os }}-node-

 - name: Install dependencies
   working-directory: ./docs
   run: npm install
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd1b0a and 1792768.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (4 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pull-request.yml

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

(action)


144-144: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)

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

40-40: Verify Flutter version compatibility

The Flutter version has been updated to 3.22.3, which is a very recent release. Please ensure that all dependencies and plugins are compatible with this version.

Run this script to check for potential compatibility issues:

✅ Verification successful

Flutter version 3.22.3 is compatible with project configuration

The Flutter SDK version 3.22.3 is compatible with:

  • Project's SDK constraints (>=2.17.0 <=3.4.4)
  • All current package dependencies using flexible version constraints
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Flutter dependencies compatibility with version 3.22.3

# Get all pubspec.yaml files
fd pubspec.yaml --type f --exec sh -c '
  echo "Checking dependencies in {}"
  grep "^[[:space:]]*flutter:" -A 5 {} || true
  echo "---"
'

Length of output: 496


Script:

#!/bin/bash
# Get complete dependency information including SDK constraints
echo "=== Main pubspec.yaml ==="
cat pubspec.yaml | grep -A 2 "sdk:"

echo -e "\n=== Checking for Flutter version constraints in all YAML files ==="
rg "sdk: flutter|flutter_version|flutter.*version" -A 2 -g "*.yaml" -g "*.yml"

Length of output: 911

.github/workflows/pull-request.yml Show resolved Hide resolved
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.55%. Comparing base (0b34401) to head (97f81c5).

Additional details and impacted files
@@                Coverage Diff                @@
##           develop-postgres    #2713   +/-   ##
=================================================
  Coverage             96.55%   96.55%           
=================================================
  Files                   189      189           
  Lines                  9994     9994           
=================================================
  Hits                   9650     9650           
  Misses                  344      344           

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

@hars-21 hars-21 had a problem deploying to TALAWA_ENVIRONMENT January 21, 2025 17:48 — with GitHub Actions Failure
@hars-21 hars-21 had a problem deploying to TALAWA_ENVIRONMENT January 21, 2025 17:49 — with GitHub Actions Failure
@hars-21
Copy link
Author

hars-21 commented Jan 21, 2025

Sorry Sir I will improve the script and will make a new PR once done. Sorry for the inconvenience.

@hars-21 hars-21 closed this Jan 21, 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.

2 participants