@@ -12,11 +12,6 @@ permissions:
12
12
actions : read
13
13
security-events : write
14
14
15
- env :
16
- # Release version of Opengrep
17
- # https://github.com/opengrep/opengrep/releases
18
- RELEASE_VERSION : v1.1.2
19
-
20
15
jobs :
21
16
build :
22
17
runs-on : ubuntu-latest
@@ -27,16 +22,21 @@ jobs:
27
22
- name : " Download / Install Opengrep"
28
23
run : |
29
24
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"
35
35
chmod +x /usr/local/bin/opengrep
36
36
echo "[+] Finished installing opengrep"
37
-
37
+
38
38
- name : " Run Opengrep"
39
- run : opengrep scan --metrics=on -- sarif-output ./results.sarif .
39
+ run : opengrep scan --sarif-output ./results.sarif .
40
40
41
41
- name : " Upload SARIF file"
42
42
uses : github/codeql-action/upload-sarif@v3
0 commit comments