Skip to content

Commit

Permalink
Added auto docs script
Browse files Browse the repository at this point in the history
  • Loading branch information
hars-21 committed Jan 21, 2025
1 parent 0b34401 commit 109cd42
Showing 1 changed file with 83 additions and 15 deletions.
98 changes: 83 additions & 15 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -94,6 +94,71 @@ jobs:
echo "Error: Close this PR and try again."
exit 1
generate-docs:
if: github.ref == 'refs/heads/develop-postgres'
runs-on: ubuntu-latest
environment: TALAWA_ENVIRONMENT

steps:
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Step 2: Set up Java
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: "zulu" # Adjust if required
java-version: "17" # Use a modern version suitable for your project

# Step 3: Set up Flutter
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "stable"
channel: "stable"

# Step 4: Set up Dart
- name: Set up Dart
uses: dart-lang/setup-dart@v1
with:
sdk: "stable"

# Step 5: Generate Dart and Flutter Documentation
- name: Generate Dart and Flutter Docs
run: |
cd talawa_lint && flutter pub get && cd ..
flutter pub get
flutter analyze
dart analyze
flutter pub global activate dartdoc
flutter pub global run dartdoc --output docs/docs/auto-docs/dart
# Step 6: Generate Java Documentation
- name: Generate Java Docs
run: |
javadoc -d docs/docs/auto-docs/java -sourcepath src -subpackages com.example
# Step 7: Check for Documentation Updates
- name: Check for Doc Updates
id: DocUpdated
run: |
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
# Step 8: Commit and Push Updates
- 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
Branch-check:
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }}
Expand Down Expand Up @@ -241,22 +306,25 @@ 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 the Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn
cache-dependency-path: 'docs/'
node-version: "20.x"

# Run Docusaurus in the ./docs directory
- name: Install dependencies
working-directory: ./docs
run: yarn install --frozen-lockfile
working-directory: ../docs
run: npm install

- name: Test building the website
working-directory: ./docs
run: yarn build
working-directory: ../docs
run: npm run build

Validate-Coderabbit:
name: Validate CodeRabbit Approval
Expand Down

0 comments on commit 109cd42

Please sign in to comment.