mirror of
https://github.com/patrickbeane/vuln-summary.git
synced 2026-03-28 09:45:31 +00:00
fix(workflow): inject summary directly into stream
This commit is contained in:
16
.github/workflows/update-vuln-summary.yml
vendored
16
.github/workflows/update-vuln-summary.yml
vendored
@@ -10,6 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # allow pushing back to the repo
|
contents: write # allow pushing back to the repo
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -29,16 +30,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Build summary string
|
- name: Build summary string
|
||||||
run: |
|
run: |
|
||||||
{
|
jq -r '.last_scan | "_Last scan: \(.date)_\n\nCritical: \(.critical)\nHigh: \(.high)\nMedium: \(.medium)\nLow: \(.low)\n\nTotal: \(.total)"' trivy_sanitized.json > summary.txt
|
||||||
echo 'SUMMARY<<EOF'
|
|
||||||
jq -r '.last_scan | "_Last scan: \(.date)_\n\nCritical: \(.critical)\nHigh: \(.high)\nMedium: \(.medium)\nLow: \(.low)\n\nTotal: \(.total)"' trivy_sanitized.json
|
|
||||||
echo 'EOF'
|
|
||||||
} >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Update README
|
- name: Update README
|
||||||
run: |
|
run: |
|
||||||
awk -v summary="_${SUMMARY}_" '
|
awk '
|
||||||
/<!-- vuln-summary-start -->/ {print; print summary; skip=1; next}
|
/<!-- vuln-summary-start -->/ {
|
||||||
|
print;
|
||||||
|
while ((getline line < "summary.txt") > 0) print line;
|
||||||
|
skip=1;
|
||||||
|
next
|
||||||
|
}
|
||||||
/<!-- vuln-summary-end -->/ {skip=0}
|
/<!-- vuln-summary-end -->/ {skip=0}
|
||||||
!skip
|
!skip
|
||||||
' README.md > README.tmp && mv README.tmp README.md
|
' README.md > README.tmp && mv README.tmp README.md
|
||||||
|
|||||||
Reference in New Issue
Block a user