diff --git a/CHANGELOG.md b/CHANGELOG.md index 397eb036..e6fd7cfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Implement potential workaround for [windows-11-arm runner bug](https://github.com/actions/partner-runner-images/issues/169) which sometimes causes installation failure. + + The issue where this bug affected the startup of bash was addressed in 2.71.2, but we received a report that the same problem seems to occur when starting other commands as well. + - Update `cargo-deny@latest` to 0.19.2. ## [2.75.13] - 2026-04-15 diff --git a/action.yml b/action.yml index 46f84f7a..1c5f7e9f 100644 --- a/action.yml +++ b/action.yml @@ -57,7 +57,7 @@ runs: for ($i=1; $i -le 10; $i++) { $prev_err_action = $ErrorActionPreference $ErrorActionPreference = "Continue" - & bash --noprofile --norc "$env:GITHUB_ACTION_PATH/main.sh" + & bash --noprofile --norc "$env:GITHUB_ACTION_PATH\main.sh" $code = $LASTEXITCODE $ErrorActionPreference = "$prev_err_action" if (Test-Path "$env:USERPROFILE\.install-action\init") { diff --git a/main.sh b/main.sh index 49bfc121..ce3ebb72 100755 --- a/main.sh +++ b/main.sh @@ -563,6 +563,7 @@ fi install_action_dir="${home}/.install-action" tmp_dir="${install_action_dir}/tmp" cargo_bin="${CARGO_HOME:-"${home}/.cargo"}/bin" +cargo_path=$(type -P cargo || true) # If $CARGO_HOME does not exist, or cargo installed outside of $CARGO_HOME/bin # is used ($CARGO_HOME/bin is most likely not included in the PATH), fallback to # $install_action_dir/bin. @@ -570,15 +571,15 @@ if [[ "${host_os}" == "windows" ]]; then mkdir -p -- "${install_action_dir}" # See action.yml. touch -- "${install_action_dir}"/init - if type -P cargo >/dev/null; then - info "cargo is located at $(type -P cargo)" - cargo_bin=$(dirname -- "$(type -P cargo)") + if [[ -n "${cargo_path}" ]]; then + info "cargo is located at ${cargo_path}" + cargo_bin="${cargo_path%/*}" else cargo_bin="${install_action_dir}/bin" fi -elif [[ ! -e "${cargo_bin}" ]] || [[ "$(type -P cargo || true)" != "${cargo_bin}/cargo"* ]]; then - if type -P cargo >/dev/null; then - info "cargo is located at $(type -P cargo)" +elif [[ ! -e "${cargo_bin}" ]] || [[ "${cargo_path}" != "${cargo_bin}/cargo"* ]]; then + if [[ -n "${cargo_path}" ]]; then + info "cargo is located at ${cargo_path}" fi # Moving files to /usr/local/bin requires sudo in some environments, so do not use it: https://github.com/taiki-e/install-action/issues/543 cargo_bin="${install_action_dir}/bin" @@ -594,7 +595,7 @@ if [[ $# -gt 0 ]]; then fi export DEBIAN_FRONTEND=noninteractive -manifest_dir="$(dirname -- "$0")/manifests" +manifest_dir="${GITHUB_ACTION_PATH}/manifests" # Inputs tool="${INPUT_TOOL:-}" @@ -987,7 +988,7 @@ if [[ ${#unsupported_tools[@]} -gt 0 ]]; then cargo install "${cargo_args[@]}" "${tool}" done fi - if ! type -P cargo >/dev/null; then + if [[ -z "${cargo_path}" ]]; then _bin_dir=$(canonicalize_windows_path "${home}/.cargo/bin") # TODO: avoid this when already added info "adding '${_bin_dir}' to PATH"