Skip to content

Commit

Permalink
fix: use jq instead of grep and sed piping for chromedriver (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbourdais authored Sep 13, 2023
1 parent 5cd25d0 commit 62fdb2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scripts/install-chromedriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ else
fi

CHROME_VERSION_STRING="$(echo "$CHROME_VERSION" | sed 's/.*Google Chrome //' | sed 's/.*Chromium //')"
# shellcheck disable=SC2001
# shellcheck disable=SC2001
CHROME_VERSION_MAJOR="$(echo "$CHROME_VERSION_STRING" | sed "s/\..*//" )"
echo "Chrome version major is $CHROME_VERSION_MAJOR"

Expand Down Expand Up @@ -157,7 +157,7 @@ else
echo $MATCHING_CHROMEDRIVER_URL_RESPONSE
if [[ $MATCHING_CHROMEDRIVER_URL_RESPONSE == 404 ]]; then
echo "Matching Chrome Driver Version 404'd, falling back to first matching major version."
CHROMEDRIVER_VERSION=$( curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | grep -o "$CHROME_VERSION_MAJOR.*" | grep -o "version.*" | grep -o '\:*'"$CHROME_VERSION_MAJOR"'.*,' | sed 's/".*//')
CHROMEDRIVER_VERSION=$( curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | jq ".milestones.\"$CHROME_VERSION_MAJOR\".version" | sed 's/\"//g')
echo "New ChromeDriver version to be installed: $CHROMEDRIVER_VERSION"
fi
echo "$CHROMEDRIVER_VERSION will be installed"
Expand Down

0 comments on commit 62fdb2b

Please sign in to comment.