Problem
.github/workflows/pr-clean-up.yml assumes the preview folder exists and that deleting it always creates a commit:
rm -r './previews/pr-${{ github.event.pull_request.number }}'
git commit -am "Delete preview for PR #${{ github.event.pull_request.number }}"
If a PR never deployed a preview, the folder was already removed, or the folder path changes, rm -r fails. If there are no tracked changes after deletion, git commit -am fails. Either case can make the cleanup workflow report a failure even though there is nothing left to clean.
Suggested fix
- Use
rm -rf or explicitly check whether the preview directory exists.
- Use
git status --porcelain before committing and skip the commit/push when there are no changes.
- Consider using pinned SHAs for the unpinned
actions/checkout@v3 step while touching the workflow.
Relevant file
.github/workflows/pr-clean-up.yml
Problem
.github/workflows/pr-clean-up.ymlassumes the preview folder exists and that deleting it always creates a commit:If a PR never deployed a preview, the folder was already removed, or the folder path changes,
rm -rfails. If there are no tracked changes after deletion,git commit -amfails. Either case can make the cleanup workflow report a failure even though there is nothing left to clean.Suggested fix
rm -rfor explicitly check whether the preview directory exists.git status --porcelainbefore committing and skip the commit/push when there are no changes.actions/checkout@v3step while touching the workflow.Relevant file
.github/workflows/pr-clean-up.yml