File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed
Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change 44 pull_request :
55
66env :
7- GIT_GITLEAKS_VERSION : 8.18.4
87 ACTIONS_STEP_DEBUG : ' ${{ secrets.ACTIONS_STEP_DEBUG }}'
98
109jobs :
@@ -14,19 +13,32 @@ jobs:
1413 steps :
15141615
17- - name : Configure gitleaks binary cache
18- id : cache
16+ - name : Install
17+ shell : bash
18+ run : |
19+ set -euo pipefail
20+ arch="$(uname)_$(uname -m)"
21+ platform=$(echo $arch | tr '[:upper:]' '[:lower:]' )
22+ echo "PLATFORM=$platform" >> $GITHUB_ENV
23+ echo "GITLEAKS_VERSION=$(curl -s https://api.github.com/repos/gitleaks/gitleaks/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')" >> $GITHUB_ENV
24+
25+ - name : Cache gitleaks archive
26+ id : cache_gitleaks
1927 uses : actions/cache@v4
2028 with :
2129 path : /usr/local/bin/gitleaks
22- key : gitleaks-${{ env.GIT_GITLEAKS_VERSION }}
30+ key : gitleaks-${{ env.PLATFORM }}-${{ env.GITLEAKS_VERSION }}
2331
24- - name : Install tools
25- if : steps.cache.outputs.cache-hit != 'true'
32+ - name : Download and configure gitleaks
33+ shell : bash
2634 run : |
27- wget -O - \
28- "https://github.com/zricethezav/gitleaks/releases/download/v${{ env.GIT_GITLEAKS_VERSION }}/gitleaks_${{ env.GIT_GITLEAKS_VERSION }}_linux_x64.tar.gz" \
29- | sudo tar xzf - -C /usr/local/bin
35+ set -euo pipefail
36+ if [[ "${{ steps.cache_gitleaks.outputs.cache-hit }}" != "true" ]]; then
37+ DOWNLOAD_URL="https://github.com/gitleaks/gitleaks/releases/download/v${{ env.GITLEAKS_VERSION }}/gitleaks_${{ env.GITLEAKS_VERSION }}_linux_x64.tar.gz"
38+ echo "Download Gitleaks ${{ env.GITLEAKS_VERSION }} for ${{ env.PLATFORM }} from ${DOWNLOAD_URL}"
39+ curl -fsSL "$DOWNLOAD_URL" | tar xzf - -C /usr/local/bin
40+ fi
41+ chmod +x /usr/local/bin/gitleaks
3042
3143 - name : Checkout
3244 uses : actions/checkout@v4
You can’t perform that action at this time.
0 commit comments