Skip to content

Commit c669530

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

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/CI.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ jobs:
192192
- '22'
193193
runs-on: ${{ matrix.settings.host }}
194194
steps:
195+
- name: Clean workspace (Linux/macOS)
196+
if: runner.os != 'Windows'
197+
run: |
198+
sudo find ${{ github.workspace }} -mindepth 1 -delete 2>/dev/null || true
199+
sudo rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.[^.]* ${{ github.workspace }}/..?* 2>/dev/null || true
200+
sudo mkdir -p ${{ github.workspace }}
201+
sudo chown -R $(whoami):$(whoami) ${{ github.workspace }}
202+
sudo chmod -R 755 ${{ github.workspace }}
203+
- name: Clean workspace (Windows)
204+
if: runner.os == 'Windows'
205+
run: |
206+
Remove-Item -Path "${{ github.workspace }}\*" -Recurse -Force -ErrorAction SilentlyContinue
207+
Remove-Item -Path "${{ github.workspace }}\.*" -Recurse -Force -ErrorAction SilentlyContinue
208+
New-Item -ItemType Directory -Path "${{ github.workspace }}" -Force | Out-Null
195209
- uses: actions/checkout@v5
196210
- name: setup pnpm
197211
uses: pnpm/action-setup@v4
@@ -233,6 +247,20 @@ jobs:
233247
- linux
234248
- ${{ contains(matrix.target, 'x86_64') && 'x64' || 'arm64' }}
235249
steps:
250+
- name: Clean workspace (Linux/macOS)
251+
if: runner.os != 'Windows'
252+
run: |
253+
sudo find ${{ github.workspace }} -mindepth 1 -delete 2>/dev/null || true
254+
sudo rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.[^.]* ${{ github.workspace }}/..?* 2>/dev/null || true
255+
sudo mkdir -p ${{ github.workspace }}
256+
sudo chown -R $(whoami):$(whoami) ${{ github.workspace }}
257+
sudo chmod -R 755 ${{ github.workspace }}
258+
- name: Clean workspace (Windows)
259+
if: runner.os == 'Windows'
260+
run: |
261+
Remove-Item -Path "${{ github.workspace }}\*" -Recurse -Force -ErrorAction SilentlyContinue
262+
Remove-Item -Path "${{ github.workspace }}\.*" -Recurse -Force -ErrorAction SilentlyContinue
263+
New-Item -ItemType Directory -Path "${{ github.workspace }}" -Force | Out-Null
236264
- uses: actions/checkout@v5
237265
- name: setup pnpm
238266
uses: pnpm/action-setup@v4
@@ -291,6 +319,20 @@ jobs:
291319
- test-macOS-windows-binding
292320
- test-linux-binding
293321
steps:
322+
- name: Clean workspace (Linux/macOS)
323+
if: runner.os != 'Windows'
324+
run: |
325+
sudo find ${{ github.workspace }} -mindepth 1 -delete 2>/dev/null || true
326+
sudo rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.[^.]* ${{ github.workspace }}/..?* 2>/dev/null || true
327+
sudo mkdir -p ${{ github.workspace }}
328+
sudo chown -R $(whoami):$(whoami) ${{ github.workspace }}
329+
sudo chmod -R 755 ${{ github.workspace }}
330+
- name: Clean workspace (Windows)
331+
if: runner.os == 'Windows'
332+
run: |
333+
Remove-Item -Path "${{ github.workspace }}\*" -Recurse -Force -ErrorAction SilentlyContinue
334+
Remove-Item -Path "${{ github.workspace }}\.*" -Recurse -Force -ErrorAction SilentlyContinue
335+
New-Item -ItemType Directory -Path "${{ github.workspace }}" -Force | Out-Null
294336
- uses: actions/checkout@v5
295337
- name: setup pnpm
296338
uses: pnpm/action-setup@v4

0 commit comments

Comments
 (0)