Skip to content

Commit d51d219

Browse files
[actions] Fix copilot-setup-steps workflow (#1390)
Fixes several issues with the `copilot-setup-steps` workflow: - **Permission denied on /mnt**: Use `sudo mkdir` and `sudo chmod` to create build directories on the secondary disk - **Broken symlinks**: Rename `externals-link`/`generated-link` to `externals`/`generated` so the build actually uses the secondary disk - **Slow disk space logging**: Simplify `log-disk-space` action to just `df -h` — the `du` commands were scanning the entire filesystem (~1m45s per call) - **PR trigger**: Add `pull_request` trigger so changes to the workflow are validated before merge
1 parent 99e2191 commit d51d219

2 files changed

Lines changed: 11 additions & 60 deletions

File tree

.github/workflows/copilot-setup-steps.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: "Copilot Setup Steps"
22

3-
on: workflow_dispatch
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
48

59
jobs:
610
copilot-setup-steps:
@@ -16,14 +20,15 @@ jobs:
1620
- name: Setup build directories on secondary disk
1721
run: |
1822
echo "Setting up build directories on /mnt (secondary disk with 66G+ free)"
19-
mkdir -p /mnt/build-output
20-
mkdir -p /mnt/externals
21-
mkdir -p /mnt/generated
23+
sudo mkdir -p /mnt/build-output
24+
sudo mkdir -p /mnt/externals
25+
sudo mkdir -p /mnt/generated
26+
sudo chmod -R 777 /mnt/build-output /mnt/externals /mnt/generated
2227
2328
# Create symlinks to use the secondary disk
2429
ln -s /mnt/build-output ./output
25-
ln -s /mnt/externals ./externals-link
26-
ln -s /mnt/generated ./generated-link
30+
ln -s /mnt/externals ./externals
31+
ln -s /mnt/generated ./generated
2732
2833
echo "Build directories configured:"
2934
ls -la | grep -E "(output|externals|generated)"
@@ -70,17 +75,13 @@ jobs:
7075

7176
- name: Log disk space (after externals cache restore)
7277
uses: ./.github/workflows/log-disk-space
73-
with:
74-
detailed: 'true'
7578

7679
- name: Run dotnet cake
7780
run: dotnet cake
7881
continue-on-error: true
7982

8083
- name: Log disk space (after dotnet cake)
8184
uses: ./.github/workflows/log-disk-space
82-
with:
83-
detailed: 'true'
8485

8586
# Save the externals cache after dotnet cake runs
8687
# This ensures the cache reflects the original config.json state
Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
name: Log Disk Space
22
description: Logs disk space usage on the runner
3-
inputs:
4-
detailed:
5-
description: 'Whether to include detailed disk analysis (true/false)'
6-
required: false
7-
default: 'false'
83
runs:
94
using: composite
105
steps:
@@ -13,48 +8,3 @@ runs:
138
run: |
149
echo "=== Disk Space Usage ==="
1510
df -h
16-
echo ""
17-
echo "=== Disk Usage by Directory (/) ==="
18-
du -h -d 1 / 2>/dev/null | sort -hr | head -20 || true
19-
echo ""
20-
echo "=== Disk Usage in Current Directory ==="
21-
du -h -d 1 . 2>/dev/null | sort -hr | head -20 || true
22-
echo ""
23-
echo "=== Disk Usage Summary ==="
24-
df -h / | tail -1 | awk '{print "Used: " $3 " / " $2 " (" $5 " full)"}'
25-
26-
# Detailed analysis if requested
27-
if [ "${{ inputs.detailed }}" = "true" ]; then
28-
echo ""
29-
echo "=== DETAILED ANALYSIS ==="
30-
echo ""
31-
echo "=== Largest directories in /home/runner ==="
32-
sudo du -h /home/runner 2>/dev/null | sort -rh | head -20
33-
echo ""
34-
echo "=== Largest directories in /opt ==="
35-
sudo du -h /opt 2>/dev/null | sort -rh | head -20
36-
echo ""
37-
echo "=== Workspace breakdown (top level) ==="
38-
du -h --max-depth=1 . 2>/dev/null | sort -rh
39-
echo ""
40-
echo "=== Workspace breakdown (2 levels deep) ==="
41-
du -h --max-depth=2 . 2>/dev/null | sort -rh | head -30
42-
echo ""
43-
echo "=== externals directory ==="
44-
du -sh ./externals/* 2>/dev/null | sort -rh | head -20 || echo "No externals"
45-
echo ""
46-
echo "=== output directory ==="
47-
du -sh ./output/* 2>/dev/null | sort -rh | head -20 || echo "No output"
48-
echo ""
49-
echo "=== generated directory ==="
50-
du -sh ./generated/* 2>/dev/null | sort -rh | head -20 || echo "No generated"
51-
echo ""
52-
echo "=== /mnt disk usage ==="
53-
du -h --max-depth=1 /mnt 2>/dev/null | sort -rh
54-
echo ""
55-
echo "=== Docker usage ==="
56-
docker system df 2>/dev/null || echo "Docker not available"
57-
echo ""
58-
echo "=== Temp directories ==="
59-
du -sh /tmp /var/tmp 2>/dev/null || true
60-
fi

0 commit comments

Comments
 (0)