-
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
when used as part of a reusable workflow the default behaviour is always to checkout "main" branch #1418
Comments
I too am experiencing this. I think this is the core issue, not in the The reporter there is saying that the So The obvious workaround is to pass Exploration of the checkout source codeThis is probably less relevant since it's fully explained by the above Github Actions issue, but my background from looking around: Looking at the source code: Line 59 in 96f5310
But yeah pretty sure it's getting it from the github context as expected and just the context contains the wrong values. |
I've been having a similar issue but When reverting to actions/[email protected] it works as expected again, checking out the correct hash. |
agh this got me most of the day today. Thanks for the detail and fix this helped! |
Hitting this as well with I've tried |
I checked the GitHub context in the reusable workflow and can see Nasty bug IMO. - name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "${{ github.head_ref || github.ref }}"
|
Hi Github team, we are impacted by this bug. Do you have any ETA or workaround solution for this ? |
We have the same issue, if someone pushes to main meanwhile a long workflow is running, the checkout action checks out new main commit and causes a lot of inconsistencies EDIT: huh! I managed to create a workflow with push-to-main trigger that calls a reusable workflow and do echo ${{ github.sha }}, sleep so for us a workaround is to use checkout action with ref: ${{ github.sha }} |
steps to reproduce:
project repository:
callable workflow:
result:
during the "Checking out the ref" step:
here's a real example: https://github.com/ahmadnassri/template-action-composite/actions/runs/5662593659/job/15342828405
The text was updated successfully, but these errors were encountered: