74 lines
1.9 KiB
YAML
74 lines
1.9 KiB
YAML
name: AitoEarn Web Check
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
env:
|
|
MONOREPO_DIR: project/aitoearn-web
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint-and-build:
|
|
name: Lint & Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check if web files changed
|
|
id: check-changes
|
|
run: |
|
|
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^project/aitoearn-web/"; then
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Skip if no changes
|
|
if: steps.check-changes.outputs.changed == 'false'
|
|
run: |
|
|
echo "No changes in project/aitoearn-web/, skipping checks"
|
|
exit 0
|
|
|
|
- name: Install pnpm
|
|
if: steps.check-changes.outputs.changed == 'true'
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- name: Setup Node.js
|
|
if: steps.check-changes.outputs.changed == 'true'
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: ${{ env.MONOREPO_DIR }}/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
if: steps.check-changes.outputs.changed == 'true'
|
|
working-directory: ${{ env.MONOREPO_DIR }}
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# - name: Run ESLint
|
|
# if: steps.check-changes.outputs.changed == 'true'
|
|
# working-directory: ${{ env.MONOREPO_DIR }}
|
|
# run: pnpm lint
|
|
|
|
- name: Run build
|
|
if: steps.check-changes.outputs.changed == 'true'
|
|
working-directory: ${{ env.MONOREPO_DIR }}
|
|
run: pnpm build
|
|
|
|
|