Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/pr-preview-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git rm -r --ignore-unmatch "pr-${PR_NUMBER}"
# `|| exit 0`: if the dir never existed (nothing staged), there is
# nothing to commit — end green rather than fail red.
git commit -m "chore: clean up Pages preview for PR #${PR_NUMBER}" || exit 0
# Commit + push only when `git rm` actually staged a removal. An
# explicit staged-changes check — NOT the old `git commit … || exit
# 0`, which also masked a genuine commit failure (hook/config error)
# and silently left a stale pr-<N>/ dir. cute-dbt#150.
if git diff --cached --quiet; then
echo "No pr-${PR_NUMBER}/ preview to remove — nothing to clean up."
exit 0
fi
git commit -m "chore: clean up Pages preview for PR #${PR_NUMBER}"
git push
10 changes: 8 additions & 2 deletions book/src/recipes/github-actions-pr-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,14 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git rm -r --ignore-unmatch "pr-${PR_NUMBER}"
# `|| exit 0`: nothing to remove → nothing to commit → end green.
git commit -m "chore: clean up Pages preview for PR #${PR_NUMBER}" || exit 0
# Commit + push only when there's a staged removal. An explicit
# staged check (not `git commit … || exit 0`, which also masks a
# genuine commit failure and silently leaves a stale dir).
if git diff --cached --quiet; then
echo "No pr-${PR_NUMBER}/ preview to remove."
exit 0
fi
git commit -m "chore: clean up Pages preview for PR #${PR_NUMBER}"
git push
```

Expand Down
Loading