From 28093960d7ab1fb38d4f8deccd35c27fda2c0826 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Fri, 12 Jul 2024 23:23:21 +0000 Subject: [PATCH] feat: add Node.js CI --- .github/workflows/labeler.yaml | 1 + .github/workflows/node.yaml | 53 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/node.yaml diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml index 2c7315f..04d333b 100644 --- a/.github/workflows/labeler.yaml +++ b/.github/workflows/labeler.yaml @@ -11,4 +11,5 @@ jobs: steps: - uses: actions/labeler@v5 with: + repo-token: ${{ secrets.LABELER_TOKEN }} configuration-path: .github/labeler.yaml diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml new file mode 100644 index 0000000..8f7a3f3 --- /dev/null +++ b/.github/workflows/node.yaml @@ -0,0 +1,53 @@ +name: Node.js CI + +on: + pull_request: + types: [opened, labeled] + branches: main + +defaults: + run: + working-directory: ./frontend + +jobs: + lint: + if: contains(github.event.pull_request.labels.*.name, 'frontend') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4.1.7 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + package_json_file: "./frontend/package.json" + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: "./frontend/.nvmrc" + cache: pnpm + cache-dependency-path: "./frontend/pnpm-lock.yaml" + - name: Install dependencies + run: pnpm install + - name: Run lint + run: pnpm lint + build: + if: contains(github.event.pull_request.labels.*.name, 'frontend') + runs-on: ubuntu-latest + needs: [lint] + steps: + - name: Checkout repo + uses: actions/checkout@v4.1.7 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + package_json_file: "./frontend/package.json" + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: "./frontend/.nvmrc" + cache: pnpm + cache-dependency-path: "./frontend/pnpm-lock.yaml" + - name: Install dependencies + run: pnpm install + - name: Run build + run: pnpm build