@@ -12,11 +12,6 @@ permissions:
1212 actions : read
1313 security-events : write
1414
15- env :
16- # Release version of Opengrep
17- # https://github.com/opengrep/opengrep/releases
18- RELEASE_VERSION : v1.1.2
19-
2015jobs :
2116 build :
2217 runs-on : ubuntu-latest
@@ -27,16 +22,21 @@ jobs:
2722 - name : " Download / Install Opengrep"
2823 run : |
2924 set -e
30-
31- echo "[+] Downloading Opengrep"
32- curl -sSfL \
33- -o "/usr/local/bin/opengrep" \
34- "https://github.com/opengrep/opengrep/releases/download/${RELEASE_VERSION}/opengrep_manylinux_x86"
25+ echo "[+] Fetching latest Opengrep release information"
26+ API_URL="https://api.github.com/repos/opengrep/opengrep/releases/latest"
27+ ASSET_NAME="opengrep_manylinux_x86"
28+ DOWNLOAD_URL=$(curl -s $API_URL | jq -r ".assets[] | select(.name==\"${ASSET_NAME}\") | .browser_download_url")
29+ if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" = "null" ]; then
30+ echo "Could not find download URL for $ASSET_NAME"
31+ exit 1
32+ fi
33+ echo "[+] Downloading Opengrep from $DOWNLOAD_URL"
34+ curl -sSfL -o "/usr/local/bin/opengrep" "$DOWNLOAD_URL"
3535 chmod +x /usr/local/bin/opengrep
3636 echo "[+] Finished installing opengrep"
37-
37+
3838 - name : " Run Opengrep"
39- run : opengrep scan --metrics=on -- sarif-output ./results.sarif .
39+ run : opengrep scan --sarif-output ./results.sarif .
4040
4141 - name : " Upload SARIF file"
4242 uses : github/codeql-action/upload-sarif@v3
0 commit comments