Skip to content

Commit

Permalink
feat: use dlcdn with archive as fallback (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu authored Nov 20, 2024
1 parent 555ae80 commit 3127a8c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
rat-version:
description: |
Apache Creadur RAT Version
See Apache archives for available versions.
See Apache dlcdn or archives for available versions.
e.g. 0.15, 0.14, ...
required: false
default: 0.16.1
Expand All @@ -42,7 +42,21 @@ runs:
shell: bash
working-directory: ${{ github.action_path }}
run: |
curl --no-progress-meter https://archive.apache.org/dist/creadur/apache-rat-${{ inputs.rat-version }}/apache-rat-${{ inputs.rat-version }}-bin.tar.gz --output apache-rat-${{ inputs.rat-version }}-bin.tar.gz
set +e
# Try Apache's Download CDN
echo "Attempting to download from Apache's Download CDN"
curl --fail --silent --no-progress-meter https://dlcdn.apache.org/creadur/apache-rat-${{ inputs.rat-version }}/apache-rat-${{ inputs.rat-version }}-bin.tar.gz --output apache-rat-${{ inputs.rat-version }}-bin.tar.gz
if [ $? -ne 0 ]; then
# It is possible that a new version was released and last version removed from dlcdn.
echo "Attempting to download from Apache's Archive"
curl --no-progress-meter https://archive.apache.org/dist/creadur/apache-rat-${{ inputs.rat-version }}/apache-rat-${{ inputs.rat-version }}-bin.tar.gz --output apache-rat-${{ inputs.rat-version }}-bin.tar.gz
if [ $? -ne 0 ]; then
echo "Failed to download Apache RAT"
exit 1
fi
fi
tar zxf apache-rat-${{ inputs.rat-version }}-bin.tar.gz
- name: Run Apache Creadur RAT with ratignore
Expand Down

0 comments on commit 3127a8c

Please sign in to comment.