Add api client with updates #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test-runner | |
on: | |
pull_request: | |
branches: | |
- dev | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install Backend Dependencies | |
run: npm install | |
- name: Generate Prisma Client | |
run: npm run prisma:generate | |
- name: Run Jest | |
run: npm run test | |
- name: Run Build | |
run: npm run build | |
- name: Run Open API Generator | |
run: npm run swagger-json | |
- name: Install Frontend Dependencies | |
run: cd frontend && npm install | |
- name: Generate OpenAPI Types | |
run: cd frontend && npm run openapi-ts-latest | |
- name: Run Next Build | |
run: cd frontend && npm run build | |
lint: | |
name: Auto-Fix Lint Issues, Generate Swagger JSON and Push to PR and Comment | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# Step 1: Checkout code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
# Step 2: Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
# Step 3: Install dependencies | |
- name: Install Dependencies | |
run: npm install | |
# Step 4: Run Linter | |
- name: Generate Prisma Client | |
run: npm run prisma:generate | |
- name: Run Format | |
run: npm run format | |
# Step 4: Run ESLint with Auto-Fix | |
- name: Run ESLint with Auto-Fix | |
id: lint_fix | |
run: | | |
npm run lint | |
# Step 5: Run Generate OpenAPI Types | |
- name: Generate OpenAPI Types | |
id: openapi_types | |
run: | | |
npm run swagger-json | |
# Step 6: Commit and Push Fixes (if any) | |
- name: Commit and Push Fixes | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
if git diff --cached --quiet; then | |
echo "No changes to push."; | |
else | |
git commit -m "chore(lint): auto-fix lint issues and generated swagger json" | |
git push origin ${{ github.head_ref }} | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run ESLint remaining issues | |
id: lint_fix_remaining | |
run: | | |
npx eslint --fix --config eslint.config.mjs --format=stylish > lint-results.txt || true | |
- name: Check Lint Results File | |
run: | | |
if [ ! -s lint-results.txt ]; then echo "No lint issues found." > lint-results.txt; fi | |
- name: Comment Remaining Lint Issues | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 | |
with: | |
header: Linter Report | |
path: lint-results.txt | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |