From 4a41c018650dc46c3f74e740ee3aabbf68bc41bb Mon Sep 17 00:00:00 2001 From: huqi Date: Wed, 24 Jun 2026 22:24:35 +0800 Subject: [PATCH 1/4] chore: add temporary typos review exporter --- .github/workflows/typos-export.yml | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/typos-export.yml diff --git a/.github/workflows/typos-export.yml b/.github/workflows/typos-export.yml new file mode 100644 index 0000000..ca9f6b5 --- /dev/null +++ b/.github/workflows/typos-export.yml @@ -0,0 +1,64 @@ +name: Temporary typos review export + +on: + push: + workflow_dispatch: + +permissions: + contents: read + +jobs: + export-review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install typos CLI + run: cargo install typos-cli --locked + + - name: Export review JSONL + shell: bash + run: | + set -uo pipefail + typos --format json . > typos-output.jsonl + typos_status=$? + python3 - <<'PY' + import json + from collections import defaultdict + + counts = defaultdict(int) + with open("typos-output.jsonl", "r", encoding="utf-8") as source, open("review.jsonl", "w", encoding="utf-8") as review: + for raw in source: + raw = raw.strip() + if not raw: + continue + item = json.loads(raw) + if "typo" not in item or "path" not in item: + continue + key = (item.get("path"), item.get("line_num"), item.get("typo")) + counts[key] += 1 + review_item = { + "path": item.get("path"), + "line_num": item.get("line_num"), + "byte_offset": item.get("byte_offset"), + "occurrence_index": counts[key], + "typo": item.get("typo"), + "corrections": item.get("corrections", []) or [], + "status": "PENDING", + "correction": "", + } + review.write(json.dumps(review_item, ensure_ascii=True) + "\n") + print("--- review.jsonl ---") + with open("review.jsonl", "r", encoding="utf-8") as review: + print(review.read(), end="") + print("--- end review.jsonl ---") + raise SystemExit(typos_status) + PY + + - name: Upload review artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: typos-review-jsonl + path: review.jsonl + if-no-files-found: error From e4da075bb54eb8ab9dddc12051201cbaa5b23e76 Mon Sep 17 00:00:00 2001 From: huqi Date: Wed, 24 Jun 2026 22:24:50 +0800 Subject: [PATCH 2/4] chore: run exporter for pull requests --- .github/workflows/typos-export.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/typos-export.yml b/.github/workflows/typos-export.yml index ca9f6b5..294fc39 100644 --- a/.github/workflows/typos-export.yml +++ b/.github/workflows/typos-export.yml @@ -2,6 +2,7 @@ name: Temporary typos review export on: push: + pull_request: workflow_dispatch: permissions: From cffb80b91f8fb34040cd3462c15d2fe02823a0f3 Mon Sep 17 00:00:00 2001 From: huqi Date: Wed, 24 Jun 2026 22:27:53 +0800 Subject: [PATCH 3/4] fix: preserve typos findings for review export --- .github/workflows/typos-export.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typos-export.yml b/.github/workflows/typos-export.yml index 294fc39..c1de436 100644 --- a/.github/workflows/typos-export.yml +++ b/.github/workflows/typos-export.yml @@ -21,8 +21,10 @@ jobs: shell: bash run: | set -uo pipefail + set +e typos --format json . > typos-output.jsonl typos_status=$? + set -e python3 - <<'PY' import json from collections import defaultdict @@ -53,11 +55,10 @@ jobs: with open("review.jsonl", "r", encoding="utf-8") as review: print(review.read(), end="") print("--- end review.jsonl ---") - raise SystemExit(typos_status) PY + exit 0 - name: Upload review artifact - if: always() uses: actions/upload-artifact@v4 with: name: typos-review-jsonl From 57d5ae698a47e96c0cb0b5d58a7a61b931779502 Mon Sep 17 00:00:00 2001 From: huqi Date: Wed, 24 Jun 2026 22:30:14 +0800 Subject: [PATCH 4/4] chore: remove temporary typos review exporter --- .github/workflows/typos-export.yml | 66 ------------------------------ 1 file changed, 66 deletions(-) delete mode 100644 .github/workflows/typos-export.yml diff --git a/.github/workflows/typos-export.yml b/.github/workflows/typos-export.yml deleted file mode 100644 index c1de436..0000000 --- a/.github/workflows/typos-export.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Temporary typos review export - -on: - push: - pull_request: - workflow_dispatch: - -permissions: - contents: read - -jobs: - export-review: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install typos CLI - run: cargo install typos-cli --locked - - - name: Export review JSONL - shell: bash - run: | - set -uo pipefail - set +e - typos --format json . > typos-output.jsonl - typos_status=$? - set -e - python3 - <<'PY' - import json - from collections import defaultdict - - counts = defaultdict(int) - with open("typos-output.jsonl", "r", encoding="utf-8") as source, open("review.jsonl", "w", encoding="utf-8") as review: - for raw in source: - raw = raw.strip() - if not raw: - continue - item = json.loads(raw) - if "typo" not in item or "path" not in item: - continue - key = (item.get("path"), item.get("line_num"), item.get("typo")) - counts[key] += 1 - review_item = { - "path": item.get("path"), - "line_num": item.get("line_num"), - "byte_offset": item.get("byte_offset"), - "occurrence_index": counts[key], - "typo": item.get("typo"), - "corrections": item.get("corrections", []) or [], - "status": "PENDING", - "correction": "", - } - review.write(json.dumps(review_item, ensure_ascii=True) + "\n") - print("--- review.jsonl ---") - with open("review.jsonl", "r", encoding="utf-8") as review: - print(review.read(), end="") - print("--- end review.jsonl ---") - PY - exit 0 - - - name: Upload review artifact - uses: actions/upload-artifact@v4 - with: - name: typos-review-jsonl - path: review.jsonl - if-no-files-found: error