Issue with fetching the latest PR commits #21553
-
There seems to be an intermittent issue while fetching the latest commits of a PR. I tried a couple of methods, but both fail intermittently. Method 1:
Method 2:
In both the cases, you will observe that the merged branch doesn’t have the latest commits. Observing this issue from the past week. Can someone help me on this? Or did anyone face this problem? PS: The above-mentioned repository is an example public repo. I am facing this with many other repositories. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Thanks for asking! It looks like you’re trying to get the latest commits on a PR by fetching the merge ref for the PR. Unfortunately, while the existence of the PR refs is well-known, we don’t make any guarantees about their operation. When a PR is updated, the merge ref is updated lazily and some changes may have happened in the last week that have made it update more lazily than in the past. What is your ultimate goal here? Would using the GitHub API be a more reliable way of getting the information you’re looking for? |
Beta Was this translation helpful? Give feedback.
-
@lee-dohm Thanks for the reply. The goal is to pull the latest changes of a PR and build (CI similar to Travis CI). We have webhooks attached to the repo, which triggers builds on push/PR commits. Could you please tell me if there is a recommended way to get a PR’s latest changes? (into a temporary branch) |
Beta Was this translation helpful? Give feedback.
-
For that, you can see my answer on this other topic. You’ll notice that it uses the head ref instead of the merge ref. |
Beta Was this translation helpful? Give feedback.
-
@lee-dohm Thank you. Using head ref solved the issue. |
Beta Was this translation helpful? Give feedback.
Thanks for asking!
It looks like you’re trying to get the latest commits on a PR by fetching the merge ref for the PR. Unfortunately, while the existence of the PR refs is well-known, we don’t make any guarantees about their operation. When a PR is updated, the merge ref is updated lazily and some changes may have happened in the last week that have made it update more lazily than in the past.
What is your ultimate goal here? Would using the GitHub API be a more reliable way of getting the information you’re looking for?