github action updated to support skip test when branch is not main #116
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests | |
| on: | |
| pull_request: | |
| jobs: | |
| test: | |
| if: github.base_ref == 'main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.2.18" | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.bun | |
| node_modules | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Generate Prisma client | |
| run: bun run generate | |
| - name: Run tests | |
| run: bun jest | |
| skip-tests: | |
| if: github.base_ref != 'main' | |
| runs-on: ubuntu-lastest | |
| steps: | |
| - name: Skip tests for non-main Prisma | |
| run: echo "Tests skipped - PR is not targeting main branch" |