Skip to content

Commit 9fc3ee3

Browse files
committed
Add version parameter for download actions
1 parent 5a22aff commit 9fc3ee3

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Diff for: .github/actions/gradle/download/action.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
token:
66
description: "GitHub token"
77
required: false
8+
version:
9+
description: "The version of the scripts to download (e.g., 'v2.7'), or empty for the latest release"
10+
required: false
811

912
runs:
1013
using: "composite"
@@ -19,8 +22,13 @@ runs:
1922
curlOpts+=(--header 'Authorization: Bearer ${{ inputs.token }}')
2023
fi
2124
25+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest"
26+
if [ ! -z "${{ inputs.version }}" ]; then
27+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/tags/${{ inputs.version }}"
28+
fi
29+
2230
# Get the download url of the latest release
23-
downloadUrl=$(curl "${curlOpts[@]}" 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 develocity-gradle)
31+
downloadUrl=$(curl "${curlOpts[@]}" "$releaseUrl" | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep develocity-gradle)
2432
2533
# Download the latest version of the build validation scripts
2634
curl "${curlOpts[@]}" --output develocity-gradle-build-validation.zip $downloadUrl

Diff for: .github/actions/maven/download/action.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
token:
66
description: "GitHub token"
77
required: false
8+
version:
9+
description: "The version of the scripts to download (e.g., 'v2.7'), or empty for the latest release"
10+
required: false
811

912
runs:
1013
using: "composite"
@@ -19,8 +22,13 @@ runs:
1922
curlOpts+=(--header 'Authorization: Bearer ${{ inputs.token }}')
2023
fi
2124
25+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest"
26+
if [ ! -z "${{ inputs.version }}" ]; then
27+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/tags/${{ inputs.version }}"
28+
fi
29+
2230
# Get the download url of the latest release
23-
downloadUrl=$(curl "${curlOpts[@]}" 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 develocity-maven)
31+
downloadUrl=$(curl "${curlOpts[@]}" "$releaseUrl" | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep develocity-maven)
2432
2533
# Download the latest version of the build validation scripts
2634
curl "${curlOpts[@]}" --output develocity-maven-build-validation.zip $downloadUrl

0 commit comments

Comments
 (0)