ci: self-heal $GITHUB_PATH/$GITHUB_ENV writes (#26037)

This commit is contained in:
Liangsheng Yin
2026-05-21 21:28:43 -07:00
committed by GitHub
parent 610f55040d
commit acb8310183
2 changed files with 12 additions and 5 deletions
+5 -1
View File
@@ -8,7 +8,11 @@ set -euxo pipefail
# GitHub Actions steps in the same job.
export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:${PATH}"
if [ -n "${GITHUB_PATH:-}" ]; then
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "${GITHUB_PATH}"
# Self-heal if _runner_file_commands/ disappears mid-job on some self-hosted
# runners; the runner reads this file by its registered UUID at step end, so
# recreating the path keeps PATH propagation working for subsequent steps.
mkdir -p "$(dirname "${GITHUB_PATH}")" 2>/dev/null || true
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "${GITHUB_PATH}" || true
fi
if command -v cargo >/dev/null 2>&1 && command -v rustc >/dev/null 2>&1; then