Forgejo actions runner PR #1162, merged in v12.0+ causes problems with actions written with nix, such as https://github.com/ajamtli/update-flake-inputs-forgejo - the checkout copied into /var/run/act in the runner environment/namespace has a .git file pointing to the original clone in the runner’s cache directory (/var/lib/runner/name/.cache on my system), but the latter directory is not actually accessible.
I’ve opened a forgejo issue, but given it’s not so much a bug as a new incompatibility, I thought it might be good to get some input from people with more nix experience than me. It looks like nix run path:<path> may work as a workaround, but I don’t know how brittle that is likely to be - it feels a little bit ‘un-nixy’, and given flakes + nix3 are still technically experimental I wonder if it’s sensible to rely on long-term?
So, making a broken Git worktree available to nix obviously isn’t helpful. (I see, that you’ve found that out in the forgejo issue as well.) From my point of view, using path:<path> is the correct and in your case intended thing to do. You broke the worktree in the first place, because you didn’t want the actions runner to have access to the original Git repo. So, it doesn’t make sense to advise nix to look for one in the action. Using path: makes this intention clear to nix as well.
So, from the original PR 1162, I don’t see any error from nix’s side, just a mismatch of expectations. There might still be the issue with nix and Git worktree, but that is besides the original point of your forgejo issue 1369.
Yeah, I’ve read the issue. You fixed the wrong problem and now you are running into this worktree issue. Just revert your proposed fix and use the path: notation. It is, what the runner intended to to in the first place. Do not trap yourself in the hole you’ve digged just because you already put work into digging.
It is a CI runner after all. It is intended to see unrelated trees of files every time it runs. There is just no point in doing all this Git worktree shenanigans. Let nix work on the tree of files because forgejo already took care of your runner seeing the right one.