fix: try to empty clone directory that is not empty #1277

Merged
mfenniak merged 1 commit from aahlenst/runner:non-empty-clone-dir into main 2026-01-13 15:51:23 +00:00
Member

When cloning an action or a workflow with git, the target directory might not be empty, for example, due to a failed cloning attempt. Because the target directory's name is derived from the repository's URL that is about to be cloned, it would be an unrecoverable situation and would require human intervention to resolve it. To reduce the likelihood of such a situation, Forgejo Runner will try to delete the directory before cloning the repository containing the action or workflow.

  • bug fixes
    • PR: fix: try to empty clone directory that is not empty
When cloning an action or a workflow with `git`, the target directory might not be empty, for example, due to a failed cloning attempt. Because the target directory's name is derived from the repository's URL that is about to be cloned, it would be an unrecoverable situation and would require human intervention to resolve it. To reduce the likelihood of such a situation, Forgejo Runner will try to delete the directory before cloning the repository containing the action or workflow. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1277): <!--number 1277 --><!--line 0 --><!--description Zml4OiB0cnkgdG8gZW1wdHkgY2xvbmUgZGlyZWN0b3J5IHRoYXQgaXMgbm90IGVtcHR5-->fix: try to empty clone directory that is not empty<!--description--> <!--end release-notes-assistant-->
fix: try to empty clone directory that is not empty
All checks were successful
checks / validate mocks (pull_request) Successful in 36s
checks / validate pre-commit-hooks file (pull_request) Successful in 37s
checks / build and test (pull_request) Successful in 56s
checks / runner exec tests (pull_request) Successful in 25s
checks / runner integration tests (pull_request) Successful in 4m12s
checks / integration tests (docker-latest) (pull_request) Successful in 7m28s
checks / integration tests (docker-stable) (pull_request) Successful in 9m44s
issue-labels / release-notes (pull_request_target) Successful in 4s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 5s
cascade / forgejo (pull_request_target) Successful in 1m44s
674cbcd6c6
aahlenst changed title from WIP: fix: try to empty clone directory that is not empty to fix: try to empty clone directory that is not empty 2026-01-12 22:16:21 +00:00
viceice approved these changes 2026-01-13 10:30:59 +00:00
mfenniak approved these changes 2026-01-13 15:51:16 +00:00
mfenniak left a comment
Owner

Makes sense to me, and the early-exit in cloneIfRequired if the repo is already in-place prevents this from being an always-clone situation. 👍

Makes sense to me, and the early-exit in `cloneIfRequired` if the repo is already in-place prevents this from being an always-clone situation. 👍
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1277
No description provided.