Skip to content

Commit 164908b

Browse files
committed
Refactor GitHub Actions workflow for security updates: corrected output variable reference for vulnerability checks, improved output formatting by removing quotes from boolean values, and added logging for the count of security findings detected.
1 parent c941759 commit 164908b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/action_publish-images-security-updates.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
scan-vulnerabilities:
2222
runs-on: ubuntu-24.04
2323
outputs:
24-
has_vulnerabilities: ${{ steps.scan.outputs.has_vulnerabilities || inputs.force_build }}
24+
has_vulnerabilities: ${{ steps.parse.outputs.has_vulnerabilities || inputs.force_build }}
2525
steps:
2626
# Single scan for both vulnerabilities and dependencies
2727
- id: scan
@@ -52,8 +52,10 @@ jobs:
5252
# Count both vulnerabilities and secrets
5353
VULN_COUNT=$(jq -r '[.Results[] | (.Vulnerabilities, .Secrets) | select(. != null) | length] | add // 0' trivy-results.json)
5454
55+
echo "Found ${VULN_COUNT} security findings"
56+
5557
if [ "${VULN_COUNT:-0}" -gt 0 ]; then
56-
echo "has_vulnerabilities='true'" >> "$GITHUB_OUTPUT"
58+
echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
5759
5860
echo "# Security Findings Found" >> $GITHUB_STEP_SUMMARY
5961
@@ -75,11 +77,11 @@ jobs:
7577
7678
echo "::notice::Found ${VULN_COUNT} security findings that need to be addressed."
7779
else
78-
echo "has_vulnerabilities='false'" >> "$GITHUB_OUTPUT"
80+
echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
7981
echo "No security findings found." >> $GITHUB_STEP_SUMMARY
8082
fi
8183
else
82-
echo "has_vulnerabilities='false'" >> "$GITHUB_OUTPUT"
84+
echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
8385
echo "::error::trivy-results.json not found"
8486
exit 1
8587
fi

0 commit comments

Comments
 (0)