Do not delete the workspace from inside it
The checkout step ran rm -rf on $GITHUB_WORKSPACE while the shell's working directory was that same path. git then failed with 'Unable to read current working directory', and every later step died with 'fork/exec /usr/bin/bash: no such file or directory' for the same reason. Both the checkout and the cleanup step now cd to / first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,10 @@ jobs:
|
||||
# and has no Node.js runtime for JavaScript actions.
|
||||
run: |
|
||||
set -eux
|
||||
# Step out of the workspace before removing it: the shell starts *in*
|
||||
# $GITHUB_WORKSPACE, and deleting the current working directory makes
|
||||
# every later command fail with "Unable to read current working directory".
|
||||
cd /
|
||||
rm -rf "$GITHUB_WORKSPACE"
|
||||
git clone --depth 1 --branch "$GITHUB_REF_NAME" \
|
||||
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" "$GITHUB_WORKSPACE"
|
||||
@@ -120,5 +124,7 @@ jobs:
|
||||
if: always()
|
||||
run: |
|
||||
# A 1.5 GB artifact per run would fill the builder otherwise.
|
||||
# Runs even when an earlier step left the workspace missing, so cd out first.
|
||||
cd /
|
||||
rm -rf "$GITHUB_WORKSPACE/dist" "$GITHUB_WORKSPACE/build" || true
|
||||
df -h / | tail -1
|
||||
|
||||
Reference in New Issue
Block a user