From ad09286c82a7d45ee0b7f4f6e866e538587d8aef Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 6 Jan 2023 00:12:24 +0900 Subject: [PATCH] Emit warning if tool is not specified If you encounter this warning, it may be due to a dependabot bug that handles `@` shorthand in wrong way. Previously, the handling of this case was platform-dependent and may or may not have resulted in an error. --- CHANGELOG.md | 6 ++++++ main.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42152143..b77ecd10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Emit warning if tool is not specified. + + If you encounter this warning, it may be due to a dependabot bug that handles `@` shorthand in wrong way. + + Previously, the handling of this case was platform-dependent and may or may not have resulted in an error. + ## [2.1.0] - 2023-01-05 - Support `grcov`. ([#41](https://github.com/taiki-e/install-action/pull/41), thanks @thomcc) diff --git a/main.sh b/main.sh index 843ae63b..36e86341 100755 --- a/main.sh +++ b/main.sh @@ -419,6 +419,12 @@ if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null || ! type -P tar &>/de esac fi +if [[ ${#tools[@]} -eq 0 ]]; then + warn "no tool specified; this may caused by dependabot bug that handles '@' shorthand in wrong way" + # Exit with 0 for backward compatibility, we want to reject it in the next major release. + exit 0 +fi + for tool in "${tools[@]}"; do if [[ "${tool}" == *"@"* ]]; then version="${tool#*@}"