Skip to content
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

NoMongo: Restore the GraphQL Introspection GitHub Action Test #3496

89 changes: 62 additions & 27 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##############################################################################

Check warning on line 1 in .github/workflows/pull-request.yml

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
##############################################################################
#
# NOTE!
Expand Down Expand Up @@ -272,35 +272,70 @@
with:
path: "./coverage/vitest/lcov.info"
min_coverage: 0

- name: Validate GraphQL schema
run: |
if [ ! -f "schema.graphql" ]; then
echo "Error: schema.graphql not found"
exit 1
fi
npx graphql-inspector validate schema.graphql src/**/*.graphql

# Graphql-Inspector:
# if: ${{ github.actor != 'dependabot[bot]' }}
# name: Runs Introspection on the GitHub talawa-api repo on the schema.graphql file
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the Repository
# uses: actions/checkout@v4

# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '22.x'

# - name: resolve dependency
# run: npm install -g @graphql-inspector/cli
Graphql-Inspector:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Runs Introspection on the GitHub talawa-api repo on the schema.graphql file
runs-on: ubuntu-latest
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'

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

# - 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

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

- name: Clone API Repository
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
# Retrieve the complete branch name directly from the GitHub context
FULL_BRANCH_NAME="$BASE_REF"
echo "FULL_BRANCH_NAME: $FULL_BRANCH_NAME"
# Clone the specified repository using the extracted branch name
if ! git ls-remote --heads https://github.com/PalisadoesFoundation/talawa-api.git $FULL_BRANCH_NAME | grep -q .; then
echo "Error: Branch '$FULL_BRANCH_NAME' does not exist in talawa-api repository"
echo "Please ensure the branch exists and you have the correct permissions"
exit 1
fi
if ! git clone --branch $FULL_BRANCH_NAME --depth 1 https://github.com/PalisadoesFoundation/talawa-api; then
echo "Error: Failed to clone talawa-api repository from branch '$FULL_BRANCH_NAME'"
echo "This could be due to network issues or repository permissions"
exit 1
fi
# Verify clone was successful
if [ ! -d "talawa-api" ]; then
echo "Error: talawa-api directory not found after clone"
exit 1
fi

- name: Validate Documents
run: |
if [ ! -f './talawa-api/schema.graphql' ]; then
echo "Error: schema.graphql not found in talawa-api"
exit 1
fi
GRAPHQL_FILES=$(find ./src/GraphQl -type f \( -name "*.ts" -o -name "*.tsx" \))
if [ -z "$GRAPHQL_FILES" ]; then
echo "Error: No GraphQL TypeScript files found"
exit 1
fi
echo "Found GraphQL files:"
echo "$GRAPHQL_FILES"
graphql-inspector validate './src/GraphQl/**/*.{ts,tsx}' './talawa-api/schema.graphql'

Start-App-Without-Docker:
name: Check if Talawa Admin app starts (No Docker)
runs-on: ubuntu-latest
Expand Down
Loading