Skip to content

Commit

Permalink
fix: "curl: (43) A libcurl function was given a bad argument"
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Jul 19, 2024
1 parent 36df7e8 commit 5253704
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ outputs:
runs:
using: 'composite'
steps:

##################################################
# Setup Cache
##################################################
Expand Down Expand Up @@ -58,23 +58,23 @@ runs:
function get_installed_version() {
"${1:-$app_home/$app_target_bin}" --version | grep -o '[^ ]*$' | grep -o '[^/]*$' | cut -c2-
}
INPUTS_VERSION_LOWERCASE="$(tr '[:upper:]' '[:lower:]' <<<"$INPUTS_VERSION")"
if [[ $INPUTS_VERSION_LOWERCASE == 'any' ]] && hash yq &>/dev/null; then
# set outputs
echo "need_cache_update=false" | tee -a "$GITHUB_OUTPUT"
case "$RUNNER_OS" in
Windows) echo "path=$(cygpath -w "$(which yq)")" | tee -a "$GITHUB_OUTPUT" ;;
*) echo "path=$(which yq)" | tee -a "$GITHUB_OUTPUT" ;;
esac
echo "version=$(get_installed_version "$(which yq)")" | tee -a "$GITHUB_OUTPUT"
else
APP_REPO_ROOT=https://github.com/mikefarah/yq
case "$RUNNER_OS" in
macOS)
app_home="$RUNNER_TEMP/yq"
Expand All @@ -100,17 +100,20 @@ runs:
app_source_bin='yq_windows_amd64.exe'
;;
esac
echo "app_home: $app_home"
echo "app_source_bin: $app_source_bin"
echo "app_target_bin: $app_target_bin"
function get_latest_version() {
(set -x; curl -sSfL --max-time 5 -o /dev/null -w '%{url_effective}' $APP_REPO_ROOT/releases/latest | grep -o '[^/]*$' | cut -c2-)
# currently broken because of https://github.com/curl/curl/issues/13845
# (set -x; curl -sSfL --max-time 5 -o /dev/null -w '%{url_effective}' $APP_REPO_ROOT/releases/latest | grep -o '[^/]*$' | cut -c2-)
(set -x; wget --spider --max-redirect=0 --timeout=5 --header='Accept: */*' https://github.com/mikefarah/yq/releases/latest 2>&1 | grep 'Location:' | awk '{print $2}' | grep -o '[^/]*$' | cut -c2-)
}
app_downloaded=false
function download_app() {
app_download_url="$APP_REPO_ROOT/releases/download/v$1/$app_source_bin"
echo "Downloading [$app_download_url]..."
Expand All @@ -119,7 +122,7 @@ runs:
chmod 777 "$app_home/$app_target_bin"
app_downloaded=true
}
case "$INPUTS_VERSION_LOWERCASE" in
any)
if [[ ! -f "$app_home/$app_target_bin" ]]; then
Expand Down Expand Up @@ -147,9 +150,9 @@ runs:
fi
;;
esac
echo "$RUNNER_TEMP/yq" >> "$GITHUB_PATH"
# prepare cache update
if [[ $INPUTS_USE_CACHE == 'true' && ${ACT:-} != 'true' ]]; then # $ACT is set when running via nektos/act
if [[ $app_downloaded == 'true' ]]; then
Expand All @@ -164,7 +167,7 @@ runs:
else
need_cache_update=false
fi
# set outputs
echo "need_cache_update=$need_cache_update" | tee -a "$GITHUB_OUTPUT"
case "$RUNNER_OS" in
Expand Down

0 comments on commit 5253704

Please sign in to comment.