Fix checkout conflict by temporarily moving cache file (#378)
Browse files- Temporarily move __cached_results.json.gz before checkout to avoid conflicts
- Restore the file after switching branches
- Resolves 'untracked working tree files would be overwritten by checkout' error
.github/workflows/generate_cached_results.yml
CHANGED
|
@@ -56,6 +56,11 @@ jobs:
|
|
| 56 |
FILE_SIZE=$(stat -f%z __cached_results.json.gz 2>/dev/null || stat -c%s __cached_results.json.gz)
|
| 57 |
echo "📦 Generated cache file: $(echo "scale=1; $FILE_SIZE/1024/1024" | bc -l)MB"
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
# Check if cached-data branch exists
|
| 60 |
if git show-ref --verify --quiet refs/remotes/origin/cached-data; then
|
| 61 |
echo "📋 Switching to existing cached-data branch"
|
|
@@ -68,6 +73,11 @@ jobs:
|
|
| 68 |
git rm -rf . 2>/dev/null || true
|
| 69 |
fi
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
# Ensure we only have the files we want
|
| 72 |
# Remove all tracked files except README.md
|
| 73 |
if [ -f "README.md" ]; then
|
|
|
|
| 56 |
FILE_SIZE=$(stat -f%z __cached_results.json.gz 2>/dev/null || stat -c%s __cached_results.json.gz)
|
| 57 |
echo "📦 Generated cache file: $(echo "scale=1; $FILE_SIZE/1024/1024" | bc -l)MB"
|
| 58 |
|
| 59 |
+
# Temporarily move the cache file to avoid checkout conflicts
|
| 60 |
+
if [ -f "__cached_results.json.gz" ]; then
|
| 61 |
+
mv __cached_results.json.gz __cached_results.json.gz.tmp
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
# Check if cached-data branch exists
|
| 65 |
if git show-ref --verify --quiet refs/remotes/origin/cached-data; then
|
| 66 |
echo "📋 Switching to existing cached-data branch"
|
|
|
|
| 73 |
git rm -rf . 2>/dev/null || true
|
| 74 |
fi
|
| 75 |
|
| 76 |
+
# Restore the cache file
|
| 77 |
+
if [ -f "__cached_results.json.gz.tmp" ]; then
|
| 78 |
+
mv __cached_results.json.gz.tmp __cached_results.json.gz
|
| 79 |
+
fi
|
| 80 |
+
|
| 81 |
# Ensure we only have the files we want
|
| 82 |
# Remove all tracked files except README.md
|
| 83 |
if [ -f "README.md" ]; then
|