Skip to content

Commit 2ddd1e6

Browse files
committed
Enhance Semgrep workflow by adding debug steps for SARIF file verification and artifact upload. This update improves error handling and provides insights into the SARIF report's existence and content, ensuring better visibility during CI runs.
1 parent 8d7b71b commit 2ddd1e6

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/semgrep.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,30 @@ jobs:
6262
echo "ok=false" >> "$GITHUB_OUTPUT"
6363
fi
6464
65+
- name: Debug SARIF and upload context
66+
if: always()
67+
run: |
68+
set -euo pipefail
69+
f="reports/semgrep.sarif"
70+
echo "event=${{ github.event_name }}"
71+
echo "repo=${{ github.repository }}"
72+
echo "head_repo=${{ github.event.pull_request.head.repo.full_name || '' }}"
73+
if [ -f "$f" ]; then
74+
echo "sarif_exists=true"
75+
ls -l "$f"
76+
wc -c "$f"
77+
python -c "import json; d=json.load(open('reports/semgrep.sarif','r',encoding='utf-8')); print(f\"sarif_runs={len(d.get('runs', []))}\"); print(f\"sarif_version={d.get('version')}\")"
78+
else
79+
echo "sarif_exists=false"
80+
fi
81+
82+
- name: Upload SARIF artifact (debug)
83+
if: always() && steps.sarif.outputs.ok == 'true'
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: semgrep-sarif
87+
path: reports/semgrep.sarif
88+
6589
- name: Upload SARIF file for GitHub Advanced Security Dashboard
6690
uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 #v4.35.2
6791
if: |

0 commit comments

Comments
 (0)