diff --git a/.github/workflows/convert_html_to_md.py b/.github/workflows/convert_html_to_md.py
new file mode 100644
index 000000000..216ad9d71
--- /dev/null
+++ b/.github/workflows/convert_html_to_md.py
@@ -0,0 +1,35 @@
+import os
+import markdownify
+
+# Define directories
+input_dir = os.path.abspath('docs/temp-docs') # HTML source directory
+output_dir = os.path.abspath('docs/docs/auto-docs') # Markdown output directory
+
+# Ensure output directory exists
+os.makedirs(output_dir, exist_ok=True)
+
+def convert_html_to_md(input_path, output_path):
+ """Recursively convert HTML files to Markdown."""
+ for root, dirs, files in os.walk(input_path):
+ # Create corresponding directories in output path
+ relative_path = os.path.relpath(root, input_path)
+ target_dir = os.path.join(output_path, relative_path)
+ os.makedirs(target_dir, exist_ok=True)
+
+ for file in files:
+ if file.endswith('.html'):
+ html_file = os.path.join(root, file)
+ md_file = os.path.join(target_dir, file.replace('.html', '.md'))
+
+ # Read HTML, convert to Markdown, and save
+ with open(html_file, 'r', encoding='utf-8') as f:
+ html_content = f.read()
+ markdown_content = markdownify.markdownify(html_content, heading_style="ATX")
+
+ with open(md_file, 'w', encoding='utf-8') as f:
+ f.write(markdown_content)
+ print(f"Converted: {html_file} -> {md_file}")
+
+if __name__ == "__main__":
+ convert_html_to_md(input_dir, output_dir)
+ print("All HTML files converted to Markdown.")
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index 54bc5eb15..f81fb9b5a 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -13,7 +13,7 @@ name: PR Workflow
on:
pull_request:
branches-ignore:
- - 'master'
+ - "master"
env:
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
@@ -33,12 +33,12 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v4
with:
- distribution: 'zulu' # See 'Supported distributions' for available options
- java-version: '17.0'
+ distribution: "zulu" # See 'Supported distributions' for available options
+ java-version: "17.0"
- uses: subosito/flutter-action@v2
with:
- flutter-version: '3.22.3'
- channel: 'stable' # or: 'beta', 'dev' or 'master'
+ flutter-version: "3.22.3"
+ channel: "stable" # or: 'beta', 'dev' or 'master'
- name: Set default branch.
run: git remote set-head origin --auto
shell: bash
@@ -94,7 +94,6 @@ jobs:
echo "Error: Close this PR and try again."
exit 1
-
Branch-check:
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }}
name: "Base branch check"
@@ -204,6 +203,73 @@ jobs:
path: "./coverage/lcov.info"
min_coverage: 92.0
+ generate-docs:
+ if: github.ref == 'refs/heads/develop-postgres' || (github.event_name == 'pull_request' && github.base_ref == 'develop-postgres')
+ name: Generate documentation
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ fetch-depth: 0
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Set up Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: "zulu"
+ java-version: "17.0"
+
+ - name: Set up Flutter
+ uses: subosito/flutter-action@v2
+ with:
+ flutter-version: "3.22.3"
+ channel: "stable"
+
+ - name: Set up Dart
+ uses: dart-lang/setup-dart@v1
+ with:
+ sdk: "3.4.4"
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.x"
+
+ - name: Install dependencies
+ run: |
+ pip install markdownify
+
+ - name: Generate docs with dartdoc
+ run: |
+ cd talawa_lint && flutter pub get && cd ..
+ flutter pub get
+ flutter analyze --no-fatal-infos
+ flutter pub global activate dartdoc
+ flutter pub global run dartdoc \
+ --output docs/temp-docs \
+ --exclude 'dart:async,dart:collection,dart:convert,dart:core,dart:developer,dart:io' \
+
+ - name: Convert HTML to Markdown
+ run: |
+ python .github/workflows/convert_html_to_md.py
+
+ - name: Clean up temporary files
+ run: |
+ rm -rf docs/temp-docs
+
+ - name: Commit and push changes
+ run: |
+ git config --global user.name "GitHub Actions"
+ git config --global user.email "actions@github.com"
+ git add docs/docs/auto-docs/*
+ git commit -m "Update documentation"
+ git push origin HEAD:${{ github.event.pull_request.head.ref }}
+
Android-Build:
name: Testing build for android
runs-on: ubuntu-latest
@@ -241,22 +307,24 @@ jobs:
name: Test Deployment to https://docs-mobile.talawa.io
runs-on: ubuntu-latest
needs: [iOS-Build, Android-Build]
- # Run only if the develop-postgres branch and not dependabot
+ # Run only if the develop-postgres branch and not dependabot
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop-postgres' }}
steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-node@v4
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
with:
- node-version: 22
- cache: yarn
- cache-dependency-path: 'docs/'
- # Run Docusaurus in the ./docs directory
+ node-version: "20.x"
+
- name: Install dependencies
working-directory: ./docs
- run: yarn install --frozen-lockfile
+ run: npm install
+
- name: Test building the website
working-directory: ./docs
- run: yarn build
+ run: npm run build
Validate-Coderabbit:
name: Validate CodeRabbit Approval