diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 206892a..19ca915 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + # all history is needed to crawl it properly + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml index 93c7e7e..25e7da8 100644 --- a/.github/workflows/test-release.yaml +++ b/.github/workflows/test-release.yaml @@ -15,7 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + # all history is needed to crawl it properly + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbe6fee..0beaa96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + # all history is needed to crawl it properly + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 9d77254..cd8739f 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -14,8 +14,13 @@ jobs: test-and-coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v3 + - name: Checkout + uses: actions/checkout@v3 + with: + # all history is needed to crawl it properly + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v3 with: python-version: '3.11' - name: Execute tests diff --git a/snippets2changelog/collector.py b/snippets2changelog/collector.py index d2d94df..24d6432 100644 --- a/snippets2changelog/collector.py +++ b/snippets2changelog/collector.py @@ -38,8 +38,12 @@ def repo_root(self) -> Path: return Path(self._repo.working_dir) @property - def branch_name(self) -> Head: - return self._repo.active_branch + def branch_name(self) -> str: + try: + return str(self._repo.active_branch) + except Exception as e: + print(f"HEAD is detached: {e}") + return str(self._repo.head.commit.hexsha) @property def tags(self) -> list[TagReference]: