Skip to content
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 using "Checkout v1", the HEAD is not at the 'GITHUB_SHA' #318

Open
BrightRan opened this issue Aug 5, 2020 · 2 comments
Open

When using "Checkout v1", the HEAD is not at the 'GITHUB_SHA' #318

BrightRan opened this issue Aug 5, 2020 · 2 comments

Comments

@BrightRan
Copy link

BrightRan commented Aug 5, 2020

Associated community ticket: https://github.community/t/weird-github-sha-on-an-action/125831

The customer setup a workflow runs on pull request event. When executing the action 'Checkout v1' in the workflow,

      - uses: actions/checkout@v1
        with:
          submodules: true

the logs of the checkout action shows:

HEAD is now at 3b3b9b4 Merge 5cae518686005d7cc12968e452105a30a2b94d01 into 4314d1734c365dcb4f8247a6106fb02a896e41f1

but when he print the commit SHA (GITHUB_SHA or github.sha), it is a different one.

GITHUB_SHA=7318c1c8750fde75becae1467aecd22a7678b4ee

A subsequent step runs failed seems is due to this problem, although the checkout step is success.

As I known, when executing checkout, by default the HEAD should be at the 'GITHUB_SHA', unless we specify another commit SHA by using the 'ref' key on the checkout action.
So, in the customer's cause, if the 'GITHUB_SHA' actually is '7318c1c8750fde75becae1467aecd22a7678b4ee', the logs of the checkout should looks like:

HEAD is now at 7318c1c Merge ...

I tested the checkout action with both v1 and v2 on my side, but never reproduced the issue.

@ericsciple
Copy link
Contributor

Try checkout v2. On a pull request it fetches the specific SHA.

V1 fetched the ref (refs/pull/…).

@BrightRan
Copy link
Author

@ericsciple ,
Looks like, the problem the customer is facing still exists.
The checkout v2 seems does not solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants