| 1 | name: AitoEarn Web Check |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | types: [opened, synchronize, reopened] |
| 6 | |
| 7 | permissions: |
| 8 | contents: read |
| 9 | pull-requests: read |
| 10 | |
| 11 | env: |
| 12 | MONOREPO_DIR: project/aitoearn-web |
| 13 | |
| 14 | concurrency: |
| 15 | group: ${{ github.workflow }}-${{ github.ref }} |
| 16 | cancel-in-progress: true |
| 17 | |
| 18 | jobs: |
| 19 | lint-and-build: |
| 20 | name: Lint & Build |
| 21 | runs-on: ubuntu-latest |
| 22 | |
| 23 | steps: |
| 24 | - name: Checkout |
| 25 | uses: actions/checkout@v4 |
| 26 | with: |
| 27 | fetch-depth: 0 |
| 28 | |
| 29 | - name: Check if web files changed |
| 30 | id: check-changes |
| 31 | run: | |
| 32 | if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^project/aitoearn-web/"; then |
| 33 | echo "changed=true" >> $GITHUB_OUTPUT |
| 34 | else |
| 35 | echo "changed=false" >> $GITHUB_OUTPUT |
| 36 | fi |
| 37 | |
| 38 | - name: Skip if no changes |
| 39 | if: steps.check-changes.outputs.changed == 'false' |
| 40 | run: | |
| 41 | echo "No changes in project/aitoearn-web/, skipping checks" |
| 42 | exit 0 |
| 43 | |
| 44 | - name: Install pnpm |
| 45 | if: steps.check-changes.outputs.changed == 'true' |
| 46 | uses: pnpm/action-setup@v4 |
| 47 | with: |
| 48 | version: 10 |
| 49 | |
| 50 | - name: Setup Node.js |
| 51 | if: steps.check-changes.outputs.changed == 'true' |
| 52 | uses: actions/setup-node@v4 |
| 53 | with: |
| 54 | node-version: 22 |
| 55 | cache: pnpm |
| 56 | cache-dependency-path: ${{ env.MONOREPO_DIR }}/pnpm-lock.yaml |
| 57 | |
| 58 | - name: Install dependencies |
| 59 | if: steps.check-changes.outputs.changed == 'true' |
| 60 | working-directory: ${{ env.MONOREPO_DIR }} |
| 61 | run: pnpm install --frozen-lockfile |
| 62 | |
| 63 | # - name: Run ESLint |
| 64 | # if: steps.check-changes.outputs.changed == 'true' |
| 65 | # working-directory: ${{ env.MONOREPO_DIR }} |
| 66 | # run: pnpm lint |
| 67 | |
| 68 | - name: Run build |
| 69 | if: steps.check-changes.outputs.changed == 'true' |
| 70 | working-directory: ${{ env.MONOREPO_DIR }} |
| 71 | run: pnpm build |
| 72 | |
| 73 | |
| 74 |