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 4
4
pull_request :
5
5
6
6
env :
7
- GIT_GITLEAKS_VERSION : 8.18.4
8
7
ACTIONS_STEP_DEBUG : ' ${{ secrets.ACTIONS_STEP_DEBUG }}'
9
8
10
9
jobs :
@@ -14,19 +13,32 @@ jobs:
14
13
steps :
15
14
16
15
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
19
27
uses : actions/cache@v4
20
28
with :
21
29
path : /usr/local/bin/gitleaks
22
- key : gitleaks-${{ env.GIT_GITLEAKS_VERSION }}
30
+ key : gitleaks-${{ env.PLATFORM }}-${{ env.GITLEAKS_VERSION }}
23
31
24
- - name : Install tools
25
- if : steps.cache.outputs.cache-hit != 'true'
32
+ - name : Download and configure gitleaks
33
+ shell : bash
26
34
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
30
42
31
43
- name : Checkout
32
44
uses : actions/checkout@v4
You can’t perform that action at this time.
0 commit comments