66 required : false
77 type : boolean
88 default : false
9+ version :
10+ description : ' Specific Selenium version or release tag to use, e.g 4.42.1'
11+ required : false
12+ default : ' '
913 gh_cli_token :
1014 description : ' GitHub CLI authentication token'
1115 required : true
@@ -22,19 +26,28 @@ runs:
2226 shell : bash
2327 env :
2428 AUTHORS : ${{ inputs.authors }}
29+ REQUESTED_VERSION : ${{ inputs.version }}
2530 run : |
2631 sudo apt update
2732 sudo apt install jq
2833 AUTH_HEADER="Authorization: token ${{ inputs.gh_cli_token }}"
29- if [ "${{ inputs.release }}" = "true" ]; then
34+ RELEASES=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/${AUTHORS}/selenium/releases)
35+ if [ -n "${REQUESTED_VERSION}" ]; then
36+ echo "Getting the requested Selenium release: ${REQUESTED_VERSION}"
37+ RELEASE=$(echo "${RELEASES}" | jq -r --arg requested "${REQUESTED_VERSION}" '[.[]? | select(.tag_name == $requested or .tag_name == ("selenium-" + $requested) or ([.assets[]?.name] | index("selenium-server-" + $requested + ".jar")))] | .[0].tag_name')
38+ if [ -z "${RELEASE}" ] || [ "${RELEASE}" = "null" ]; then
39+ echo "Requested Selenium release not found: ${REQUESTED_VERSION}"
40+ exit 1
41+ fi
42+ elif [ "${{ inputs.release }}" = "true" ]; then
3043 echo "Getting the latest stable release."
31- RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/${AUTHORS}/selenium/releases | jq -r '[.[]? | select(.prerelease == false)] | .[0].tag_name')
44+ RELEASE=$(echo "${RELEASES}" | jq -r '[.[]? | select(.prerelease == false)] | .[0].tag_name')
3245 else
3346 echo "Getting the latest Nightly release."
34- RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/${AUTHORS}/selenium/releases | jq -r '[.[]? | select(.prerelease == true)] | .[0].tag_name' || echo "")
47+ RELEASE=$(echo "${RELEASES}" | jq -r '[.[]? | select(.prerelease == true)] | .[0].tag_name' || echo "")
3548 if [ -z "${RELEASE}" ] || [ "${RELEASE}" = "null" ]; then
3649 echo "Nightly release not found, getting the latest stable release."
37- RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/${AUTHORS}/selenium/releases | jq -r '[.[]? | select(.prerelease == false)] | .[0].tag_name')
50+ RELEASE=$(echo "${RELEASES}" | jq -r '[.[]? | select(.prerelease == false)] | .[0].tag_name')
3851 fi
3952 fi
4053 jar_file=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/${AUTHORS}/selenium/releases/tags/${RELEASE} | jq -r '.assets[] | select(.name | endswith(".jar")) | .name' | tail -n 1)
0 commit comments