Skip to content

Commit cd9fb68

Browse files
github/workflows: Improve handling of shallow repositories in diff-cover fetch
- Updated `git fetch` logic to handle shallow repositories properly, fetching full history if needed to find the merge base. - Ensures compatibility with diff-cover requirements for pull requests. Assisted-by: Codex
1 parent 4c0c168 commit cd9fb68

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/test-and-publish.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ jobs:
4040
PDFREST_API_KEY: ${{ secrets.PDFREST_API_KEY }}
4141
- name: Fetch base branch for diff-cover
4242
if: github.event_name == 'pull_request'
43-
run: git fetch origin ${{ github.base_ref }} --depth=0
43+
run: |
44+
if git rev-parse --is-shallow-repository | grep -q true; then
45+
git fetch --no-tags --prune origin ${{ github.base_ref }} --unshallow
46+
else
47+
git fetch --no-tags --prune origin ${{ github.base_ref }}
48+
fi
4449
- name: Run diff-cover (new code must be >= 90%)
4550
if: github.event_name == 'pull_request'
4651
run: >

0 commit comments

Comments
 (0)