From 30c891e7f317ff463f604d7674acd8e149efc471 Mon Sep 17 00:00:00 2001 From: Augustin Cisterne-Kaas Date: Tue, 17 Oct 2023 14:03:14 +0800 Subject: [PATCH] fix: subject without readings (#61) --- .github/workflows/ci.yml | 2 ++ hebikani/hebikani.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7235ad..d5bac2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,8 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} pypi: needs: Release + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') + concurrency: release runs-on: ubuntu-latest steps: - name: Checkout diff --git a/hebikani/hebikani.py b/hebikani/hebikani.py index 81c31b6..3fefd2d 100755 --- a/hebikani/hebikani.py +++ b/hebikani/hebikani.py @@ -900,7 +900,16 @@ def readings(self): self._readings = AnswerManager( [ Answer(answer, QuestionType.READING) - for answer in self.data["data"]["readings"] + for answer in self.data["data"].get( + "readings", + [ + { + "primary": True, + "reading": self.data["data"]["characters"], + "accepted_answer": True, + } + ], + ) ] ) return self._readings