-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while checking out: "fatal: reference is not a tree" #23
Comments
This is really weird, looks like the wrong GITHUB_REF and GITHUB_SHA get send to the runner, so the checkout action does not checkout the PR merge ref, instead, it tries to checkout the SHA from the PR source branch, which is wrong. I can confirm the problem in my repo as well:
looks like this happened recently since the PR run I have last night is able to get the right merge ref.
|
@jpkrohling thanks for reporting, we are investigating. |
Looks like the wrong REF only happened when we try to re-run a failed workflow. |
At the moment, the payloads on re-run are currently not exactly the same as the original run, which is not what users are expecting of course. @iheanyi is working on fixing this as part of in the PR he just referenced ^ |
Any news on this one? Sometimes, I have the feeling that it's fixed, but then, recent re-checks fail with the same symptom... |
@iheanyi any luck with this? |
@soluchok Apologies, we're still working on a fix for this! I was on vacation, so I'll hopefully get one in soon and update this ticket accordingly. |
@iheanyi I'm hitting this too, but in a slightly different pattern. Example failed run: https://github.com/emberjs/data/pull/6655/checks?check_run_id=285284611 This is a workflow that compares the built assets of the PR to master, so it does some git maneuvering:
About 3-5% of the time we hit this, re-running the check it will be fine. For instance in the above failure the sha was When rerunning the sha became: In this particular failure a force-push was involved but I've hit it at around the same rate without force-push as well. I suspect this was probably a stale sha. |
@runspired Is this for re-triggering a workflow or just a regular run? |
@iheanyi regular run. I traced down the cause I think (in the twitter thread I added you to) |
@iheanyi thread: https://twitter.com/Runspired/status/1191746539372212224 Roughly I believe the root of the issue is a race condition between when @actions/checkout triggers the checkout and when the merge commit has been created in the repo. If the checkout occurs before the commit is created, then checkout results in creating the merge commit itself which results in a different SHA than the SHA that is used for For some reason this condition is far more common when it is a new commit to an open PR. I suspect roughly the flow behind the scenes is (in order of A -> G) success
failure
|
Also if anyone else hits this I fixed this in my flows by using
Which I can then access in later steps via
|
Just got the same error: My PR HEAD is 60f77e1dbfcc35b60992f25edc89f9bda98c539b But github.sha is a5adf7586c64f47a1bee01b449f663f8c7c840a4 |
@ramonmedeiros in your case, is a5adf758 the merge commit? For PRs, the action checks-out the merge commit by default. If you want to checkout the PR HEAD commit, you can do this |
@iheanyi do you know whether the fix has rolled out now for the race condition? |
@ericsciple The first part has been addressed, the re-run errors that is. I'm unsure if the other issues are still occurring. |
Closing since I think this is fixed by Reopen if still occurring. Noise has gone down since last comments in November. V2 preview was early December, and then GA late December so more evidence this is fixed now. |
Checkout v1 has a known flake: actions/checkout#23 (comment). For our linter to pass, we need to checkout our full history (default depth is 1 commit). We could set fetch-depth, but we will eventually move that depth past the linter's start point commit and need to implement another fix. Indead, we add an extra step in our linter to fetch full history so that the linter reference commit is found.
"fatal: reference is not a tree" is a known issue in actions/checkout#23 and fixed in checkout@v2, update checkout used in GitHub actions.
Our build is still affected by this issue, and v2 version doesn't seem to do a difference. Similar to what @localheinz commented, we also use |
We also see this bug. I'd like to assist in fixing it ASAP by providing all necessary information for tracking down the issue. Versions of the software we use: GitHub Enterprise Server 2.20.19 |
@wl2776 this repo is for GitHub Actions. If you are seeing bugs in various Jenkins plugins please report those there. |
The last comment is from half a year ago so I'd like to update and say this issue is indeed still happening. I can't see why it is closed, because the "145 hidden items - Load more items" button doesn't work, but if it was fix, looks like the fix is incomplete or there are multiple ways to trigger this issue. |
Ran into this issue as I've got the same error in my github action. For me it was resolved today by running Reasoning: seems like github creates a shallow-depth git repo by default as the HTH. Action YML:
shell script in repo root: ls -lr
git config user.email github-action@hobbelt.com
git config user.name Github-Action
git pull --all
# show the branches known to git: allows visual check in 'actions' web page
git branch -a
# create local branch when running the action
git checkout -b clean-marker --track remotes/origin/clean-marker
# `ls -lr` for visual feedback and check to see if checkout command succeeded indeed
ls -lr
# do some work on that branch (anything) -- instead of working on HEAD
echo "replace : colons in filenames"
find . -name '*:*' -print | sed -e 's/\(.*\)/mv "\1" @@ "\1"/' -e 's/@@ \(.*\):\(.*\)/\1_\2/g' > rn_us.sh
chmod a+x rn_us.sh
cat rn_us.sh
./rn_us.sh
ls -lr
find . -name '*_*' -print | grep -v '\.git'
find . -name '*_*' -print | grep -v '\.git' | xargs -n 1 -d '\n' git add
# push back the edits into my own github repo
git commit -a -m "fixed file names for Windows compatibility"
git push --all NOTE: I suspect the shallow repo copy as any |
> Are you using "actions/checkout@v2" or "actions/checkout@v1"? This sounds like a race condition that was fixed in v2. > actions/checkout#222 (comment) > Closing since I think this is fixed by "actions/checkout@v2". > actions/checkout#23 (comment)
* empty commit * add paths-ignore * fix * tmp * debug * fix PATH * debug ssh if failure * linuxbrew * add comment * fix chflags * fix * gemrc * env * resource_dir * alias by OS * relogin * brew * comment * rbenv, pyenv * workaround for actions/checkout#23 * fix * rename * fix * off debug * plugin * fix * fix * fix * fix * try to use gdircolors on linux * fix description * install ruby on linux * mild fix comment * gls * fail safe * mild fix * try rbenv * mild fix desc * mild fix command * mild fix desc * update doc * update doc * fix actions trigger * update doc * update doc * update doc * update doc * mild fix comment * fix comment * mild update doc * mild fix * mild update doc * fix alias * empty commit * chflags * off debug option * fix * fix
This seems to be it in my case - made a dummy commit and now the workflow is running fine. Using Amplify though. |
Looks like still unfixed. |
I'm sorry if this is not the right place for this issue, but it's where it looked most appropriate to me.
When re-triggering a workflow for the PR #620 in the Jaeger Operator, the checkout step fails with:
I can confirm that the commit exists in the fork, so, I'm not sure what the action is complaining about:
The text was updated successfully, but these errors were encountered: