File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,20 @@ jobs:
4747 - name : check-warns
4848 run : |
4949 if [[ -s "output.txt" ]]; then
50- errors=$(cat output.txt)
51- errors="${errors//'%'/'%25'}"
52- errors="${errors//$'\n'/'%0A'}"
53- errors="${errors//$'\r'/'%0D'}"
54- echo "::error file=output.txt::$errors"
55- exit=1
50+ errors=$(cat output.txt)
51+ errors="${errors//'%'/'%25'}"
52+ errors="${errors//$'\n'/'%0A'}"
53+ errors="${errors//$'\r'/'%0D'}"
54+ echo "::error file=output.txt::$errors"
55+ exit=1
5656 fi
5757 if [ ${exit} == 1 ]; then
5858 exit 1;
5959 fi
60+
61+ - name : Annotate
62+ 63+ with :
64+ token : ${{ secrets.GITHUB_TOKEN }}
65+ input : ' ./violations.json'
66+ title : ' Violations'
Original file line number Diff line number Diff line change 77import argparse
88import re
99from unidiff import PatchSet
10+ import json
1011
1112if "ZEPHYR_BASE" not in os .environ :
1213 exit ("$ZEPHYR_BASE environment variable undefined." )
@@ -58,6 +59,7 @@ def main():
5859 zephyr_base = os .getenv ("ZEPHYR_BASE" )
5960 violations = {}
6061 numViolations = 0
62+ vlist = []
6163
6264 for f in patch_set :
6365 if not f .path .endswith (".c" ) and not f .path .endswith (".h" ) or not os .path .exists (zephyr_base + "/" + f .path ):
@@ -78,6 +80,13 @@ def main():
7880 if line .is_added :
7981 violation = "{}:{}" .format (f .path , line .target_line_no )
8082 if violation in violations :
83+ v = {}
84+ v ['message' ] = "\t \n " .join (violations [violation ])
85+ v ['path' ] = violation .split (":" )[0 ]
86+ v ['line' ] = { "start" : violation .split (":" )[1 ], "end" : violation .split (":" )[1 ] }
87+ v ['column' ] = { "start" : 0 , "end" : 0 }
88+ v ['level' ] = "warning"
89+ vlist .append (v )
8190 numViolations += 1
8291 if args .output :
8392 with open (args .output , "a+" ) as fp :
@@ -89,7 +98,8 @@ def main():
8998 "{}:{}" .format (
9099 violation , "\t \n " .join (
91100 violations [violation ])))
92-
101+ with open ('violations.json' , 'w' ) as outfile :
102+ json .dump (vlist , outfile )
93103 return numViolations
94104
95105
You can’t perform that action at this time.
0 commit comments