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

Testing #2885

Closed
wants to merge 7 commits into from
Closed

Testing #2885

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/schema-generation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Generate GraphQL Schema
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
generate-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Start application and wait for server
run: |
# Start the server in the background
npm run start &
# Store the PID of the npm process
SERVER_PID=$!
# Wait for the server to be ready (max 60 seconds)
COUNTER=0
until $(curl --output /dev/null --silent --fail http://localhost:4000/graphql); do
if [ $COUNTER -gt 60 ]; then
echo "Server failed to start within 60 seconds"
exit 1
fi
echo "Waiting for server to be ready... ($COUNTER seconds)"
sleep 1
let COUNTER=COUNTER+1
done
echo "Server is ready!"
# Generate schemas
npm run generate:graphql-schema
npm run generate:graphql-markdown
# Kill the server
kill $SERVER_PID
- name: Commit and push if changes exist
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ -n "$(git status --porcelain)" ]]; then
git add docs/docs/Schema.md docs/github-actions/schema.json
git commit -m "chore: update GraphQL schema"
git push
else
echo "No changes to commit"
fi
16 changes: 6 additions & 10 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@

# Change to the current directory

# Checks code for typescript type errors and throws errors if found.
npm run typecheck
# Wait for server to be ready (adjust sleep time as needed)
sleep 10

# Formats staged code using prettier
# Checks and fixes all lint issues in code which don't require manual intervention.
# Throws errors if lint issues requiring manual intervention are found in code.
# Run your commands
npm run format:fix
# npm run lint:fix
npm run lint-staged

npm run gen:schema

# Generate table of contents for markdown files in root directory
npm run typecheck
npm run update:toc

# Add the changes made to the stage
git add .
Loading
Loading