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

Feature/admin docs gen #3157

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##############################################################################

Check warning on line 1 in .github/workflows/pull-request.yml

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
##############################################################################
#
# NOTE!
Expand Down Expand Up @@ -449,3 +449,91 @@
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}

generate-docs:
name: Generate Auto Documentation
permissions:
contents: write

runs-on: ubuntu-latest
needs: [Code-Quality-Checks, Test-Application, Start-App-Without-Docker, Docker-Start-Check]

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

# Step 2: Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'

# Step 3: Install dependencies
- name: Install Dependencies
run: |
npm ci
npm install -g typedoc typedoc-plugin-markdown

# Step 4: Generate Documentation
- name: Generate Documentation
run: |
typedoc \
--out docs/docs/auto-docs \
--plugin typedoc-plugin-markdown \
--theme markdown \
--tsconfig tsconfig.json \
--excludePrivate \
--excludeProtected \
--excludeExternals \
--hideGenerator \
--categorizeByGroup true \
--entryPointStrategy expand \
--entryPoints "src/**/*.ts" "src/**/*.tsx" \
--exclude "**/*.{test,spec,stories}.{ts,tsx}" \
--exclude "**/__tests__/**" \
--exclude "**/__mocks__/**" \
--exclude "**/node_modules/**" \
--cleanOutputDir true

# Step 5: Create placeholder documentation (only if not present)
- name: Create Placeholder Documentation
run: |
mkdir -p docs/docs/user-guide
mkdir -p docs/docs/developer-guide/reference
if [ ! -f docs/docs/user-guide/intro.md ]; then
echo "# User Guide\n\nThis section contains the user guide for Talawa Admin." > docs/docs/user-guide/intro.md
fi
if [ ! -f docs/docs/developer-guide/intro.md ]; then
echo "# Developer Guide\n\nThis section contains the developer guide for Talawa Admin." > docs/docs/developer-guide/intro.md
fi
if [ ! -f docs/docs/developer-guide/reference/README.md ]; then
echo "# API Reference\n\nThis section contains the auto-generated API documentation for Talawa Admin." > docs/docs/developer-guide/reference/README.md
fi
Comment on lines +506 to +518
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

Fix shell script escaping in placeholder creation.

The echo commands with escape sequences should use printf for proper expansion.

Apply this diff:

      - name: Create Placeholder Documentation
        run: |
          mkdir -p docs/docs/user-guide
          mkdir -p docs/docs/developer-guide/reference
          if [ ! -f docs/docs/user-guide/intro.md ]; then
-            echo "# User Guide\n\nThis section contains the user guide for Talawa Admin." > docs/docs/user-guide/intro.md
+            printf "# User Guide\n\nThis section contains the user guide for Talawa Admin.\n" > docs/docs/user-guide/intro.md
          fi
          if [ ! -f docs/docs/developer-guide/intro.md ]; then
-            echo "# Developer Guide\n\nThis section contains the developer guide for Talawa Admin." > docs/docs/developer-guide/intro.md
+            printf "# Developer Guide\n\nThis section contains the developer guide for Talawa Admin.\n" > docs/docs/developer-guide/intro.md
          fi
          if [ ! -f docs/docs/developer-guide/reference/README.md ]; then
-            echo "# API Reference\n\nThis section contains the auto-generated API documentation for Talawa Admin." > docs/docs/developer-guide/reference/README.md
+            printf "# API Reference\n\nThis section contains the auto-generated API documentation for Talawa Admin.\n" > docs/docs/developer-guide/reference/README.md
          fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Create Placeholder Documentation
run: |
mkdir -p docs/docs/user-guide
mkdir -p docs/docs/developer-guide/reference
if [ ! -f docs/docs/user-guide/intro.md ]; then
echo "# User Guide\n\nThis section contains the user guide for Talawa Admin." > docs/docs/user-guide/intro.md
fi
if [ ! -f docs/docs/developer-guide/intro.md ]; then
echo "# Developer Guide\n\nThis section contains the developer guide for Talawa Admin." > docs/docs/developer-guide/intro.md
fi
if [ ! -f docs/docs/developer-guide/reference/README.md ]; then
echo "# API Reference\n\nThis section contains the auto-generated API documentation for Talawa Admin." > docs/docs/developer-guide/reference/README.md
fi
- name: Create Placeholder Documentation
run: |
mkdir -p docs/docs/user-guide
mkdir -p docs/docs/developer-guide/reference
if [ ! -f docs/docs/user-guide/intro.md ]; then
printf "# User Guide\n\nThis section contains the user guide for Talawa Admin.\n" > docs/docs/user-guide/intro.md
fi
if [ ! -f docs/docs/developer-guide/intro.md ]; then
printf "# Developer Guide\n\nThis section contains the developer guide for Talawa Admin.\n" > docs/docs/developer-guide/intro.md
fi
if [ ! -f docs/docs/developer-guide/reference/README.md ]; then
printf "# API Reference\n\nThis section contains the auto-generated API documentation for Talawa Admin.\n" > docs/docs/developer-guide/reference/README.md
fi
🧰 Tools
🪛 actionlint (1.7.4)

507-507: shellcheck reported issue in this script: SC2028:info:4:8: echo may not expand escape sequences. Use printf

(shellcheck)


507-507: shellcheck reported issue in this script: SC2028:info:7:8: echo may not expand escape sequences. Use printf

(shellcheck)


507-507: shellcheck reported issue in this script: SC2028:info:10:8: echo may not expand escape sequences. Use printf

(shellcheck)


# Step 6: Commit Documentation Changes
- name: Commit Documentation Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git"
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout ${{ github.event.pull_request.head.ref }}
git add docs/docs/auto-docs/
git add docs/docs/developer-guide/
git add docs/docs/user-guide/
if [ -n "$(git status --porcelain)" ]; then
git commit -m "docs: update auto-generated documentation [skip ci]"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
else
echo "No changes to commit."
fi

Empty file added docs/docs/auto-docs/.gitignore
Empty file.
Empty file.
4 changes: 2 additions & 2 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Let's discover **Docusaurus in less than 5 minutes**.

Get started by **creating a new site**.

Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.
Or **try Docusaurus immediately** with **[docusaurus.new]**.

### What you'll need

- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
- version 18.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.

## Generate a new site
Expand Down
8 changes: 0 additions & 8 deletions docs/docs/tutorial-basics/_category_.json

This file was deleted.

23 changes: 0 additions & 23 deletions docs/docs/tutorial-basics/congratulations.md

This file was deleted.

34 changes: 0 additions & 34 deletions docs/docs/tutorial-basics/create-a-blog-post.md

This file was deleted.

57 changes: 0 additions & 57 deletions docs/docs/tutorial-basics/create-a-document.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/docs/tutorial-basics/create-a-page.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/docs/tutorial-basics/deploy-your-site.md

This file was deleted.

Loading
Loading