mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-24 02:29:35 -06:00
63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
name: Format Check (Client & Server)
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
format-client:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Install client dependencies
|
|
working-directory: client
|
|
run: npm ci
|
|
|
|
- name: Check client formatting
|
|
working-directory: client
|
|
run: npm run format-check
|
|
|
|
format-server:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Install server dependencies
|
|
working-directory: server
|
|
run: npm ci
|
|
|
|
- name: Check server formatting
|
|
working-directory: server
|
|
run: npm run format-check
|
|
close-pr-if-needed:
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
needs: [format-client, format-server]
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get PR number
|
|
id: pr
|
|
run: echo "PR_NUMBER=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
|
|
|
|
- name: Close PR using GitHub CLI
|
|
if: |
|
|
needs.format-client.result == 'failure' ||
|
|
needs.format-server.result == 'failure'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh pr close "$PR_NUMBER" --delete-branch --comment "❌ Formatting check failed — PR auto-closed.
|
|
Please run \`npm run format\` in both `client` and `server` directories and push again."
|