Detect file renames without triggering deletions #1735
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: Check | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| merge_group: | |
| jobs: | |
| yarn: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .tool-versions | |
| - run: yarn | |
| env: | |
| # https://yarnpkg.com/features/security#hardened-mode | |
| YARN_ENABLE_HARDENED_MODE: 1 | |
| biome: | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .tool-versions | |
| - run: yarn | |
| - run: yarn turbo check-biome check-prettier | |
| eslint: | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .tool-versions | |
| - run: yarn | |
| - run: yarn turbo check-eslint | |
| typescript: | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .tool-versions | |
| - run: yarn | |
| - run: yarn turbo check-svelte check-typescript | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .tool-versions | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: | | |
| {plugins,packages}/*/src/** | |
| {plugins,packages}/*/test/** | |
| {plugins,packages}/*/*.test.ts | |
| {plugins,packages}/*/*.test.tsx | |
| {plugins,packages}/*/vitest.config.ts | |
| {plugins,packages}/*/test-setup.ts | |
| - name: Install dependencies | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: yarn | |
| - name: Test scripts | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: yarn run test:scripts | |
| - name: Get changed workspaces | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| id: changed-workspaces | |
| run: | | |
| # Extract unique workspace paths from changed files | |
| WORKSPACES=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | \ | |
| grep -oE '(plugins|packages)/[^/]+' | \ | |
| sort -u | \ | |
| tr '\n' ' ') | |
| echo "workspaces=$WORKSPACES" >> $GITHUB_OUTPUT | |
| echo "Changed workspaces: $WORKSPACES" | |
| - name: Run tests for changed workspaces | |
| if: steps.changed-files.outputs.any_changed == 'true' && steps.changed-workspaces.outputs.workspaces != '' | |
| run: | | |
| for workspace in ${{ steps.changed-workspaces.outputs.workspaces }}; do | |
| echo "Checking tests for workspace: $workspace" | |
| if [ -f "$workspace/package.json" ] && grep -q '"check-vitest"' "$workspace/package.json"; then | |
| name=$(jq -r '.name' "$workspace/package.json") | |
| yarn workspace "$name" check-vitest | |
| else | |
| echo "No check-vitest script found for $workspace, skipping..." | |
| fi | |
| done |