Skip to content

Commit 71388dd

Browse files
authored
fix: Vulnerability checks: create issue only when checked was done (#125)
1 parent 9e6041b commit 71388dd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/check-binaries.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ jobs:
3434
id: save-output
3535
run: |
3636
report_csv="$(ls -tr output.cve-bin-*.csv 2>/dev/null | tail -n1)" # last file generated
37-
echo "Vulnerabilities stored in $report_csv"
37+
if [ -z "$report_csv" ]; then
38+
echo "No file with vulnerabilities. Probably a failure in previous step."
39+
else
40+
echo "Vulnerabilities stored in $report_csv"
41+
fi
3842
final_report="${report_csv}.txt"
3943
awk -F',' '{n=split($10, path, "/"); print $2,$3,$4,$5,path[n]}' "$report_csv" | column -t > "$final_report" # make the CSV nicer
4044
echo "report_contents<<EOF" >> "$GITHUB_OUTPUT"
4145
cat "$final_report" >> "$GITHUB_OUTPUT"
4246
echo "EOF" >> "$GITHUB_OUTPUT"
43-
- if: always() && steps.check-binaries.outcome == 'failure'
47+
- if: always() && steps.save-output.outputs.report_contents
4448
name: Build new binaries and check vulnerabilities again
4549
id: check-new-version
4650
run: |
@@ -50,7 +54,7 @@ jobs:
5054
latest_version=$(strings bin/aws-lambda-rie* | grep '^go1\.' | sort | uniq)
5155
echo "latest_version=$latest_version" >> "$GITHUB_OUTPUT"
5256
make check-binaries
53-
- if: always() && steps.check-binaries.outcome == 'failure'
57+
- if: always() && steps.save-output.outputs.report_contents
5458
name: Save outputs for the check with the latest build
5559
id: save-new-version
5660
run: |
@@ -60,7 +64,7 @@ jobs:
6064
fixed="Yes"
6165
fi
6266
echo "fixed=$fixed" >> "$GITHUB_OUTPUT"
63-
- if: always() && steps.check-binaries.outcome == 'failure'
67+
- if: always() && steps.save-output.outputs.report_contents
6468
name: Create GitHub Issue indicating vulnerabilities
6569
id: create-issue
6670
uses: dacbd/create-issue-action@main

0 commit comments

Comments
 (0)