Skip to content

Commit 9fd6cbf

Browse files
committed
zizmor: print relevant field of each result
1 parent 8553f01 commit 9fd6cbf

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.github/workflows/periodic-zizmor.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,30 @@ jobs:
106106
id: print-results
107107
env:
108108
REPO: ${{ matrix.repository.repo }}
109+
shell: python
109110
run: |
110-
echo "repo=${REPO}, results=${results.sarif}"
111+
import json
112+
import os
113+
114+
repo = os.environ['REPO']
115+
116+
with open('results.sarif', 'r') as f:
117+
sarif_data = json.load(f)
118+
119+
results = []
120+
for result in sarif_data['runs'][0]['results']:
121+
item = {
122+
'repo': repo,
123+
'kind': result['kind'],
124+
'level': result['level'],
125+
'message': result['message']['text'],
126+
'annotation': result['locations'][0]['logicalLocations'][0]['properties']['symbolic']['annotation'],
127+
'path': result['locations'][0]['logicalLocations'][0]['properties']['symbolic']['key']['Local']['given_path']
128+
}
129+
results.append(item)
130+
131+
for item in results:
132+
print(f"repo={item['repo']}, kind={item['kind']}, level={item['level']}, message={item['message']}, annotation={item['annotation']}, path={item['path']}")
111133
112134
- name: Upload SARIF results
113135
uses: actions/github-script@v7

0 commit comments

Comments
 (0)