Skip to content

Commit 8295478

Browse files
committed
Enhance GitHub Actions release workflow for accurate ancestry checks
- Updated the release workflow to ensure sufficient history for accurate ancestry checks by modifying the fetch logic for `origin/main`. - Added conditional checks to handle shallow repositories, improving reliability in CI/CD processes.
1 parent 88ad224 commit 8295478

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ jobs:
1919
- uses: actions/checkout@v6
2020
- name: Ensure tag points to main
2121
run: |
22-
git fetch origin main --depth=1
23-
git merge-base --is-ancestor "${GITHUB_SHA}" origin/main
22+
# `actions/checkout` is typically shallow; ensure we have enough `origin/main`
23+
# history for an accurate ancestry check.
24+
if git rev-parse --is-shallow-repository | grep -q true; then
25+
git fetch --no-tags --prune --unshallow origin main
26+
else
27+
git fetch --no-tags --prune origin main
28+
fi
29+
git merge-base --is-ancestor "${GITHUB_SHA}^{}" origin/main
2430
- uses: actions-rust-lang/setup-rust-toolchain@v1
2531
with:
2632
components: rustfmt, clippy

0 commit comments

Comments
 (0)