Skip to content

Commit

Permalink
refactor: github-workflow to autogenerate docs from codebase's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rukhsarkh committed Jan 2, 2025
1 parent fdd0182 commit a597b22
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Check formatting
if: steps.changed-files.outputs.only_changed != 'true'
run: npm run format:check

- name: Run formatting if check fails
if: failure()
run: npm run format:fix
Expand All @@ -57,10 +57,10 @@ jobs:

- name: Check for linting errors in modified files
if: steps.changed-files.outputs.only_changed != 'true'
env:
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: npx eslint ${CHANGED_FILES}

- name: Check for TSDoc comments
run: npm run check-tsdoc # Run the TSDoc check script

Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Changed Unauthorized files
id: changed-unauth-files
uses: tj-actions/changed-files@v45
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
docs/docusaurus.config.ts
docs/sidebar*
CNAME
- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
env:
env:
CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }}
run: |
for file in ${CHANGED_UNAUTH_FILES}; do
Expand All @@ -164,14 +164,14 @@ jobs:
uses: tj-actions/changed-files@v45

- name: Echo number of changed files
env:
env:
CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }}
run: |
echo "Number of files changed: $CHANGED_FILES_COUNT"
- name: Check if the number of changed files is less than 100
if: steps.changed-files.outputs.all_changed_files_count > 100
env:
env:
CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }}
run: |
echo "Error: Too many files (greater than 100) changed in the pull request."
Expand Down Expand Up @@ -218,12 +218,13 @@ jobs:

- name: Run Python script
run: |
python .github/workflows/scripts/code_coverage_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
python .github/workflows/scripts/code_coverage_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
Test-Application:
name: Test Application
runs-on: ubuntu-latest
needs: [Code-Quality-Checks, Check-ESlint-Disable,Check-Code-Coverage-Disable]
needs:
[Code-Quality-Checks, Check-ESlint-Disable, Check-Code-Coverage-Disable]
steps:
- name: Checkout the Repository
uses: actions/checkout@v4
Expand All @@ -235,11 +236,11 @@ jobs:

- name: Install Dependencies
run: npm install

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v45

- name: Run Jest Tests
if: steps.changed-files.outputs.only_changed != 'true'
env:
Expand All @@ -261,8 +262,8 @@ jobs:
if ! npx lcov-result-merger 'coverage/*/lcov.info' > 'coverage/lcov.info'; then
echo "Failed to merge coverage reports"
exit 1
fi
fi
- name: TypeScript compilation for changed files
run: |
for file in ${{ steps.changed-files.outputs.all_files }}; do
Expand All @@ -284,7 +285,7 @@ jobs:
- name: Test acceptable level of code coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: "./coverage/lcov.info"
path: './coverage/lcov.info'
min_coverage: 0.0

# Graphql-Inspector:
Expand All @@ -302,19 +303,19 @@ jobs:

# - name: resolve dependency
# run: npm install -g @graphql-inspector/cli

# - name: Clone API Repository
# run: |
# # Retrieve the complete branch name directly from the GitHub context
# FULL_BRANCH_NAME=${{ github.base_ref }}
# echo "FULL_Branch_NAME: $FULL_BRANCH_NAME"

# # Clone the specified repository using the extracted branch name
# git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a
# git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a

# - name: Validate Documents
# run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql'

Start-App-Without-Docker:
name: Check if Talawa Admin app starts (No Docker)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -403,7 +404,7 @@ jobs:
name: Test Deployment to https://docs-admin.talawa.io
runs-on: ubuntu-latest
needs: [Docker-Start-Check, Start-App-Without-Docker]
# 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
Expand Down Expand Up @@ -431,7 +432,7 @@ jobs:
echo "Error: Pull request target branch must be 'develop-postgres'. Please refer PR_GUIDELINES.md"
echo "Error: Close this PR and try again."
exit 1
generate-docs:
name: Generate Auto Documentation
runs-on: ubuntu-latest
Expand Down Expand Up @@ -470,7 +471,7 @@ jobs:
echo "Documentation generation failed"
exit 1
fi
- name: Setup Git Config
- name: Setup Git Config
run: |
if ! git config user.name "GitHub Actions Bot" || \
! git config user.email "41898282+github-actions[bot]@users.noreply.github.com"; then
Expand All @@ -493,12 +494,18 @@ jobs:
exit 1
fi
fi
Validate-Coderabbit:
name: Validate CodeRabbit Approval
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
needs: [Code-Quality-Checks, Test-Application, Start-App-Without-Docker, Docker-Start-Check]
needs:
[
Code-Quality-Checks,
Test-Application,
Start-App-Without-Docker,
Docker-Start-Check,
]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -510,4 +517,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}

0 comments on commit a597b22

Please sign in to comment.