Skip to content

Commit

Permalink
try fixing detached head and set fetch-depth to all history
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics committed May 30, 2024
1 parent c3535bd commit 0c2408d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions snippets2changelog/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 0c2408d

Please sign in to comment.