-
Notifications
You must be signed in to change notification settings - Fork 35
Generate gql-errors index.adoc file #302
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
Changes from 3 commits
80a1119
46f97d1
b09450a
41bca50
3fa7626
f7f50bf
53ea84f
a2fa821
c8aa182
7e84c28
355a851
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,7 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Script to generate, validate, and update the GQL error index | ||
| # This script will: | ||
| # 1. Generate auto-index.adoc using the template | ||
| # 2. Validate that it matches the content of index.adoc | ||
| # 3. If validation passes, replace index.adoc with auto-index.adoc | ||
|
|
||
| set -e # Exit on any error | ||
| # Script to validate and update the GQL error index | ||
|
||
| # This script follows a specific workflow to maintain error documentation consistency | ||
|
|
||
| # Define paths | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
|
@@ -23,34 +18,50 @@ fi | |
|
|
||
| echo "===== Starting GQL Error Index Update Process =====" | ||
|
|
||
| # Step 1: Generate auto-index.adoc | ||
| echo "Generating auto-index.adoc from template..." | ||
| python3 "$SCRIPT_DIR/generate-gql-error-index-from-template.py" | ||
| # Step 1: Validate index.adoc against the individual files | ||
| echo "Step 1: Validating index.adoc against individual files..." | ||
| python3 "$SCRIPT_DIR/validate-error-index.py" | ||
| VALIDATION_RESULT=$? | ||
|
|
||
| if [ ! -f "$AUTO_INDEX_FILE" ]; then | ||
| echo "Error: Failed to generate auto-index.adoc" | ||
| exit 1 | ||
| fi | ||
| # Step 2: Check validation result | ||
| if [ $VALIDATION_RESULT -eq 0 ]; then | ||
| echo "✅ Validation passed! index.adoc is consistent with individual files." | ||
| echo "No further action needed." | ||
| exit 0 | ||
| else | ||
| echo "❌ Validation failed. Checking if there are missing entries..." | ||
|
|
||
| echo "Generation completed successfully." | ||
| # Step 3: Generate auto-index.adoc | ||
| echo "Step 3: Generating auto-index.adoc from template..." | ||
| python3 "$SCRIPT_DIR/generate-gql-error-index-from-template.py" | ||
| GENERATION_RESULT=$? | ||
|
|
||
| # Step 2: Validate auto-index.adoc against the files. | ||
| echo "Validating auto-index.adoc against the files and index.adoc..." | ||
| python3 "$SCRIPT_DIR/validate_error_index.py" | ||
| VALIDATION_RESULT=$? | ||
| if [ $GENERATION_RESULT -ne 0 ] || [ ! -f "$AUTO_INDEX_FILE" ]; then | ||
| echo "Error: Failed to generate auto-index.adoc" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Step 3: If validation passes, replace index.adoc with auto-index.adoc | ||
| if [ $VALIDATION_RESULT -eq 0 ]; then | ||
| echo "Validation passed! Replacing index.adoc with auto-index.adoc..." | ||
| echo "Generation completed successfully." | ||
|
|
||
| # Replace index with auto-index | ||
| rm "$INDEX_FILE" | ||
| mv "$AUTO_INDEX_FILE" "$INDEX_FILE" | ||
| # Step 4: Validate auto-index.adoc against individual files | ||
| echo "Step 4: Validating auto-index.adoc against individual files..." | ||
| python3 "$SCRIPT_DIR/validate-error-auto-index.py" | ||
| AUTO_VALIDATION_RESULT=$? | ||
|
|
||
| echo "✅ Update completed successfully. index.adoc has been updated." | ||
| else | ||
| echo "❌ Validation failed with exit code $VALIDATION_RESULT. No changes were made to index.adoc." | ||
| echo "Please review the validation errors and fix any discrepancies." | ||
| fi | ||
| # Step 5: If auto-index validation passes, replace index.adoc | ||
| if [ $AUTO_VALIDATION_RESULT -eq 0 ]; then | ||
| echo "Step 5: Auto-index validation passed! Replacing index.adoc with auto-index.adoc..." | ||
|
|
||
| # Replace index with auto-index | ||
| rm "$INDEX_FILE" | ||
| mv "$AUTO_INDEX_FILE" "$INDEX_FILE" | ||
|
|
||
| exit $VALIDATION_RESULT | ||
| echo "✅ Update completed successfully. index.adoc has been updated." | ||
| exit 0 | ||
| else | ||
| echo "❌ Auto-index validation failed with exit code $AUTO_VALIDATION_RESULT." | ||
| echo "No changes were made to index.adoc." | ||
| echo "Please review the validation errors and fix any discrepancies." | ||
| exit $AUTO_VALIDATION_RESULT | ||
| fi | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.