From 43c380b236e46ac5876ba65e36709481676e51f6 Mon Sep 17 00:00:00 2001 From: Rukh-Khan Date: Thu, 2 Jan 2025 19:02:11 +0530 Subject: [PATCH] refactor: github-workflow to autogenerate docs from codebase's comments --- .github/workflows/pull-request.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3ba869c2a3..e3f3e67b3b 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -453,7 +453,7 @@ jobs: # Create auto-docs directory if it doesn't exist mkdir -p docs/docs/auto-docs # Generate documentation using TypeDoc - typedoc \ + if ! typedoc \ --out docs/docs/auto-docs \ --plugin typedoc-plugin-markdown \ --tsconfig tsconfig.json \ @@ -465,11 +465,17 @@ jobs: --exclude "**/*.test.tsx" \ --exclude "**/*.spec.ts" \ --exclude "**/*.spec.tsx" + echo "Documentation generation failed" + exit 1 + fi - name: Setup Git Config run: | - git config user.name "GitHub Actions Bot" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + if ! git config user.name "GitHub Actions Bot" || \ + ! git config user.email "41898282+github-actions[bot]@users.noreply.github.com"; then + echo "Failed to configure Git" + exit 1 + fi - name: Commit changes run: | @@ -479,12 +485,14 @@ jobs: if git diff --staged --quiet; then echo "No changes to commit" else + echo "Committing changes to documentation" git commit -m "chore(docs): update auto-generated API documentation [skip ci]" # Push to the feature branch git push origin feature/admin-docs-refactor || { - echo "Failed to push changes" - exit 1 - } + git push origin "${{ github.head_ref }}" || { + echo "Failed to push changes" + exit 1 + } fi Validate-Coderabbit: