diff options
| author | Claude <noreply@anthropic.com> | 2026-11-05 00:55:20 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-11-05 00:55:20 +0000 |
| commit | 94aad60c27bde35441c9b05c515f74fe67e10837 (patch) | |
| tree | b60b6d71987457d8b4f4d00daa562288f37d27ce /.github/scripts/sg_platform_annotate.py | |
| parent | fa4eb54397ee2faccb6940512a19c017cb1337f3 (diff) | |
Merged candidate for security-guidance 2.0.18 with platform tests (6999 update)mhegazy/sg2018batch
Co-authored-by: mhegazy <mhegazy@anthropic.com>
Diffstat (limited to '.github/scripts/sg_platform_annotate.py')
| -rw-r--r-- | .github/scripts/sg_platform_annotate.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.github/scripts/sg_platform_annotate.py b/.github/scripts/sg_platform_annotate.py new file mode 100644 index 00000000..e8567d81 --- /dev/null +++ b/.github/scripts/sg_platform_annotate.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +"""Print ten chunks of a text file as notice annotations, starting at chunk N.""" +import sys + +CHUNK = 3600 # an annotation keeps 4096 bytes +lines = open(sys.argv[1], encoding="utf-8", errors="replace").read().splitlines() +chunks, current = [], "" +for line in lines: + if current and len((current + line).encode("utf-8")) + 1 > CHUNK: + chunks.append(current) + current = "" + current += line[:CHUNK] + "\n" +if current: + chunks.append(current) +first = int(sys.argv[2]) +for index in range(first, min(first + 10, len(chunks))): + body = chunks[index].replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A") + print("::notice title=report %03d of %03d::%s" % (index + 1, len(chunks), body)) +if first == 0: + print("%d chunks, %d characters" % (len(chunks), sum(map(len, chunks)))) |
