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

Created on 5 Aug 2020  Â·  2Comments  Â·  Source: actions/checkout

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.

Most helpful comment

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

All 2 comments

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

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

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

Was this page helpful?
0 / 5 - 0 ratings