Skip to content

Commit 2b2cf2e

Browse files
committed
ci: clean before checkout
1 parent c669530 commit 2b2cf2e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/CI.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ jobs:
2828
name: Lint
2929
runs-on: [self-hosted, macos]
3030
steps:
31+
- name: Clean workspace (Linux/macOS)
32+
if: runner.os != 'Windows'
33+
run: |
34+
sudo find ${{ github.workspace }} -mindepth 1 -delete 2>/dev/null || true
35+
sudo rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.[^.]* ${{ github.workspace }}/..?* 2>/dev/null || true
36+
sudo mkdir -p ${{ github.workspace }}
37+
sudo chown -R $(whoami):$(whoami) ${{ github.workspace }}
38+
sudo chmod -R 755 ${{ github.workspace }}
39+
- name: Clean workspace (Windows)
40+
if: runner.os == 'Windows'
41+
run: |
42+
Remove-Item -Path "${{ github.workspace }}\*" -Recurse -Force -ErrorAction SilentlyContinue
43+
Remove-Item -Path "${{ github.workspace }}\.*" -Recurse -Force -ErrorAction SilentlyContinue
44+
New-Item -ItemType Directory -Path "${{ github.workspace }}" -Force | Out-Null
3145
- uses: actions/checkout@v5
3246
- name: setup pnpm
3347
uses: pnpm/action-setup@v4
@@ -86,6 +100,20 @@ jobs:
86100
name: stable - ${{ matrix.settings.target }} - node@20
87101
runs-on: ${{ matrix.settings.host }}
88102
steps:
103+
- name: Clean workspace (Linux/macOS)
104+
if: runner.os != 'Windows'
105+
run: |
106+
sudo find ${{ github.workspace }} -mindepth 1 -delete 2>/dev/null || true
107+
sudo rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.[^.]* ${{ github.workspace }}/..?* 2>/dev/null || true
108+
sudo mkdir -p ${{ github.workspace }}
109+
sudo chown -R $(whoami):$(whoami) ${{ github.workspace }}
110+
sudo chmod -R 755 ${{ github.workspace }}
111+
- name: Clean workspace (Windows)
112+
if: runner.os == 'Windows'
113+
run: |
114+
Remove-Item -Path "${{ github.workspace }}\*" -Recurse -Force -ErrorAction SilentlyContinue
115+
Remove-Item -Path "${{ github.workspace }}\.*" -Recurse -Force -ErrorAction SilentlyContinue
116+
New-Item -ItemType Directory -Path "${{ github.workspace }}" -Force | Out-Null
89117
- uses: actions/checkout@v5
90118
- name: setup pnpm
91119
uses: pnpm/action-setup@v4

0 commit comments

Comments
 (0)