-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Checkout action with branch as ref not consistent through workflow #1634
Comments
I also have the same problem. When not specifying a ref, the checkout action will use the I will open a pull request for this. |
I didn't actually fully read through your issue. Sorry! The behavior of the pull request synchronization is that it fetches the The problem I had is that I have jobs that can span between minutes, and between the first job run and the last, if a new commit is added to the Either way - #1858 should solve this issue. |
I have both problems, where either can be the solution, thank you very much :) |
I recently moved my github actions workflow to trigger on pull_request which has a different checkout behavior than on push. Then to ensure that the git repo was consistent both on push and on pr, I used the checkout action to check out the current branch.
My main issue with the default checkout on pr was that running git commands doesn't give expected output for instance
git branch
andgit show -s --format=%B
.The issue that now occurs is that a workflow starts running on the main branch with one commit, but during the workflow, something else is merged to that branch and the next job then checks out the latest commit instead of the commit it started running with. I tried checkout out the current commit throughout the workflow instead. In python in the workflow a: return Repo(repo_root_path).active_branch.name works on push events, but in prs, results in:
HEAD is a detached symbolic reference as it points to SHA
. Also with ref: ${{ github.event.pull_request.head.sha }}, but works with ref: current_branch_nameIs there a way to check out a branch at a given commit consistently through a workflow both on push and on pr, for instance:
or any other way to check out the same commit throughout a workflow while also having access to the git information?
uaing fetch-depth:0 makes no difference.
The text was updated successfully, but these errors were encountered: