Skip to content

Commit 1cd9724

Browse files
committed
CR follow-up: Set Github token as optional input
Signed-off-by: Jerome Prinet <[email protected]>
1 parent d062c51 commit 1cd9724

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/actions/gradle/download/action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ description: "Download latest release"
44
inputs:
55
token:
66
description: "Github token"
7-
required: true
7+
required: false
88

99
runs:
1010
using: "composite"
1111
steps:
1212
- name: Get latest release
1313
run: |
14-
downloadUrl=$(curl -S -H 'authorization: Bearer ${{ inputs.token }}' https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep -v maven)
14+
cmdGetDownloadUrl="curl -s"
15+
if [ ! -z "${{ inputs.token }}" ]; then
16+
cmdGetDownloadUrl="$cmdGetDownloadUrl --header 'Authorization: Bearer ${{ inputs.token }}'"
17+
fi
18+
cmdGetDownloadUrl="$cmdGetDownloadUrl https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest"
19+
20+
#downloadUrl=$(curl -s $(authHeader) https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep -v maven)
21+
downloadUrl=$($cmdGetDownloadUrl | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep -v maven)
22+
#curl -s -L -o gradle-enterprise-gradle-build-validation.zip $downloadUrl
1523
curl -s -L -o gradle-enterprise-gradle-build-validation.zip $downloadUrl
1624
unzip -q -o gradle-enterprise-gradle-build-validation.zip
1725
shell: bash

0 commit comments

Comments
 (0)