@@ -33,16 +33,20 @@ jobs:
3333 reports = json.load(f)
3434
3535 words = set()
36+
3637 for report in reports:
3738 for lint in report.get("lints", []):
3839 if lint.get("kind") == "Spelling":
3940 word = lint.get("matched_text")
4041 if word:
4142 words.add(word)
4243
43- print("Suggested dictionary candidates:")
44- for word in sorted(words, key=str.lower):
45- print(word)
44+ with open("dictionary-candidates.txt", "w", encoding="utf-8") as out:
45+ out.write("Suggested dictionary candidates:\n")
46+ for word in sorted(words, key=str.lower):
47+ out.write(word + "\n")
48+
49+ print(open("dictionary-candidates.txt", encoding="utf-8").read())
4650 PY
4751
4852 - name : Check Selected Harper Rules
5963
6064 for report in reports:
6165 file = report.get("file")
62- path = Path(file)
63- lines = path.read_text(encoding="utf-8", errors="ignore").splitlines() if path.exists() else []
66+ path = Path(file) if file else None
67+ lines = path.read_text(encoding="utf-8", errors="ignore").splitlines() if path and path .exists() else []
6468
6569 for lint in report.get("lints", []):
6670 kind = lint.get("kind")
@@ -80,13 +84,28 @@ jobs:
8084 keep = True
8185
8286 if keep:
83- selected.append((file, line_no, kind, rule, text, message))
87+ selected.append(
88+ f"{file}:{line_no}: [{kind}::{rule}] {text!r} - {message}"
89+ )
90+
91+ with open("filtered-harper-report.txt", "w", encoding="utf-8") as out:
92+ for item in selected:
93+ out.write(item + "\n")
8494
8595 if selected:
8696 print("Selected Harper lints found:")
87- for file, line, kind, rule, text, message in selected:
88- print(f"{file}:{line}: [{kind}::{rule}] {text!r} - {message}")
97+ print(open("filtered-harper-report.txt", encoding="utf-8").read())
8998 sys.exit(1)
9099
91100 print("No selected Harper lints found.")
92101 PY
102+
103+ - name : Upload Harper Reports
104+ if : always()
105+ uses : actions/upload-artifact@v6
106+ with :
107+ name : harper-reports
108+ path : |
109+ harper-report.json
110+ filtered-harper-report.txt
111+ dictionary-candidates.txt
0 commit comments