fix: Use git reset --hard instead of pull and checkout for actions #1156

Merged
mfenniak merged 4 commits from mfenniak/forgejo-runner:fix-git-update-cleanup into main 2025-11-17 03:29:05 +00:00
Owner

Primary credit to @drewcassidy for 99% of the work in #1096: Attempt to fix #1071

The error in question was happening in the git fetch step due to the working tree having updates (finding what is modifying the working tree is a puzzle for another day). This is fixed by passing Force=true to the fetch command (I am unclear on what this means. vanilla git fetch doesnt care about the working tree at all)

Fixing this, it still failed due to the working tree. The current code is doing something silly with a pull and checkout, but a hard reset is probably the most robust solution.

  • bug fixes
    • PR: fix: Use git reset --hard instead of pull and checkout for actions
Primary credit to @drewcassidy for 99% of the work in #1096: Attempt to fix #1071 The error in question was happening in the git fetch step due to the working tree having updates (finding what is modifying the working tree is a puzzle for another day). This is fixed by passing Force=true to the fetch command (I am unclear on what this means. vanilla `git fetch` doesnt care about the working tree at all) Fixing this, it still failed due to the working tree. The current code is doing something silly with a pull and checkout, but a hard reset is probably the most robust solution. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1156): <!--number 1156 --><!--line 0 --><!--description Zml4OiBVc2UgZ2l0IHJlc2V0IC0taGFyZCBpbnN0ZWFkIG9mIHB1bGwgYW5kIGNoZWNrb3V0IGZvciBhY3Rpb25z-->fix: Use git reset --hard instead of pull and checkout for actions<!--description--> <!--end release-notes-assistant-->
Also use force fetch whatever that means
fix indents
All checks were successful
checks / validate pre-commit-hooks file (pull_request) Successful in 1m8s
checks / validate mocks (pull_request) Successful in 1m32s
checks / build and test (pull_request) Successful in 3m20s
checks / runner exec tests (pull_request) Successful in 55s
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / runner integration tests (pull_request) Successful in 7m10s
checks / integration tests (pull_request) Successful in 11m2s
1b6d6ed3d7
only log about cloning if clone was actually run
All checks were successful
issue-labels / release-notes (pull_request_target) Successful in 39s
checks / validate pre-commit-hooks file (pull_request) Successful in 1m6s
checks / validate mocks (pull_request) Successful in 1m32s
checks / build and test (pull_request) Successful in 3m5s
checks / runner exec tests (pull_request) Successful in 26s
checks / runner integration tests (pull_request) Successful in 6m0s
checks / integration tests (pull_request) Successful in 11m27s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 4s
cascade / forgejo (pull_request_target) Successful in 1m4s
f81d8f567b
Contributor

cascading-pr updated at actions/setup-forgejo#760

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/760
mfenniak force-pushed fix-git-update-cleanup from fae08049ad
All checks were successful
checks / validate mocks (pull_request) Successful in 49s
checks / validate pre-commit-hooks file (pull_request) Successful in 43s
/ example-docker-compose (pull_request) Successful in 2m15s
example / docker-build-push-action-in-lxc (pull_request) Successful in 2m32s
checks / build and test (pull_request) Successful in 2m48s
checks / runner exec tests (pull_request) Successful in 25s
Integration tests for the release process / release-simulation (pull_request) Successful in 4m44s
/ example-lxc-systemd (pull_request) Successful in 7m42s
checks / runner integration tests (pull_request) Successful in 5m20s
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / integration tests (pull_request) Successful in 13m0s
cascade / end-to-end (pull_request_target) Successful in 37m3s
to fe9a61a03a
All checks were successful
checks / build and test (pull_request) Successful in 2m32s
checks / validate mocks (pull_request) Successful in 45s
checks / validate pre-commit-hooks file (pull_request) Successful in 37s
checks / runner exec tests (pull_request) Successful in 31s
checks / runner integration tests (pull_request) Successful in 5m49s
checks / integration tests (pull_request) Successful in 12m37s
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
2025-11-14 21:16:16 +00:00
Compare
Contributor

cascading-pr updated at actions/setup-forgejo#760

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/760
mfenniak changed title from WIP: fix: Use git reset --hard instead of pull and checkout for actions to fix: Use git reset --hard instead of pull and checkout for actions 2025-11-14 22:40:07 +00:00
Author
Owner

@drewcassidy If it'd be possible for you to review this incremental change to your PR, I'd appreciate the additional eyes on it.

@drewcassidy If it'd be possible for you to review this incremental change to your PR, I'd appreciate the additional eyes on it.
mfenniak deleted branch fix-git-update-cleanup 2025-11-17 03:29:06 +00:00
Sign in to join this conversation.
No reviewers
No milestone
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!1156
No description provided.