From ee8ca54da1ba06b8dbfd9cb8f717669ef68eaca2 Mon Sep 17 00:00:00 2001 From: korone00 Date: Wed, 20 Aug 2025 12:49:10 +0900 Subject: [PATCH] ci: optimize PR checks and Docker build workflow --- .github/workflows/docker-publish.yml | 6 +---- .github/workflows/pr-checks.yml | 33 ++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pr-checks.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 7e55bc3..f4ad724 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,9 +6,6 @@ on: - main tags: - 'v*' - pull_request: - branches: - - main workflow_dispatch: env: @@ -30,7 +27,6 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} @@ -54,7 +50,7 @@ jobs: with: context: . platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..b56901a --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,33 @@ +name: PR Checks + +on: + pull_request: + branches: + - main + types: [opened, synchronize, reopened] + +jobs: + lint-and-format: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: npm run lint + + - name: Check formatting with Prettier + run: npm run format:check + + - name: Type check + run: npm run check \ No newline at end of file diff --git a/package.json b/package.json index 5f1962b..421494e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write .", + "format:check": "prettier --check .", "test:server": "node test-server.cjs", "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui",