Skip to content

Commit 47cb291

Browse files
Added new SBOM config for generation all 3 reports
1 parent ef5ecea commit 47cb291

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/scripts/sbom_json_to_csv.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22
import csv
33
import sys
4-
from pathlib import Path
4+
# from pathlib import Path
55
from tabulate import tabulate
66

77
input_file = sys.argv[1] if len(sys.argv) > 1 else "sbom.json"
@@ -23,6 +23,7 @@
2323
"externalRefs"
2424
]
2525

26+
2627
def get_type(pkg):
2728
spdxid = pkg.get("SPDXID", "")
2829
if "-" in spdxid:
@@ -35,10 +36,12 @@ def get_type(pkg):
3536
return ref.get("referenceLocator", "").split("/")[0]
3637
return ""
3738

39+
3840
def get_external_refs(pkg):
3941
refs = pkg.get("externalRefs", [])
4042
return ";".join([ref.get("referenceLocator", "") for ref in refs])
4143

44+
4245
with open(output_file, "w", newline="", encoding="utf-8") as csvfile:
4346
writer = csv.DictWriter(csvfile, fieldnames=columns)
4447
writer.writeheader()
@@ -57,6 +60,7 @@ def get_external_refs(pkg):
5760

5861
print(f"CSV export complete: {output_file}")
5962

63+
6064
with open("sbom_table.txt", "w", encoding="utf-8") as f:
6165
table = []
6266
for pkg in packages:

scripts/update-sbom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ def main() -> None:
1818

1919

2020
if __name__ == "__main__":
21-
main()
21+
main()
22+

0 commit comments

Comments
 (0)