This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit feb2ee024363ed0e1a6c40e25d3ea79d7044ff89 Author: Szymon Janc <[email protected]> AuthorDate: Thu Oct 22 19:07:59 2026 +0200 ci: Remove toolchain only if installed in home directory Toolchain directory to remove was derived from toolchain path by stripping $HOME prefix and taking first path component. If toolchain were ever installed outside home directory (e.g. in tool cache) that component would be empty and whole home directory, including workspace, would be removed. Remove directory only if toolchain path is inside home directory and only warn otherwise. Assisted-by: Claude:claude-opus-5-5 --- .github/actions/gcc-target-build/action.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/gcc-target-build/action.yml b/.github/actions/gcc-target-build/action.yml index 92c409988..ed736095d 100644 --- a/.github/actions/gcc-target-build/action.yml +++ b/.github/actions/gcc-target-build/action.yml @@ -60,6 +60,14 @@ runs: env: GCC_PATH: ${{ steps.gcc.outputs.path }} run: | - # Toolchain is installed in directory in home directory - dir="${GCC_PATH#"$HOME"/}" - rm -rf "$HOME/${dir%%/*}" + # Toolchain is installed in directory in home directory, never + # remove anything if it is elsewhere (it would remove $HOME). + case "$GCC_PATH" in + "$HOME"/[!/]*) + dir="${GCC_PATH#"$HOME"/}" + rm -rf "${HOME:?}/${dir%%/*}" + ;; + *) + echo "::warning::Toolchain not in $HOME, not removed: $GCC_PATH" + ;; + esac
