Checkout: confirm that default checks out GITHUB_SHA

Created on 13 Aug 2019  路  8Comments  路  Source: actions/checkout

I'd like to confirm what happens when I just use the checkout action with all defaults, such as in the below:

name: Document Conversion

on: push

jobs:
  convert_via_pandoc:
    name: Convert via Pandoc
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v1
      - uses: maxheld83/pandoc@master
        with:
          args: "--standalone --output=index.html README.md"

My assumption would be that behind the scenes something like git clone and git checkout $GITHUB_SHA happens, so that this always puts whatever git ref the push event brought along into GITHUB_WORKSPACE.

The docs are a little hazy on this:

To create a specific copy of your repository, you can checkout a specific branch, SHA, or tag from your repository, with the with syntax:

```

They don't however state explicitly what the default behavior is.

I've tested this empirically and I seem to be correct, but I'd like to be certain.

Would be nice to

  • [x] confirm that I got this right
  • [ ] change the docs accordingly

Most helpful comment

I still think it might help other users if this was briefly mentioned that by default, the action checks out $GITHUB_SHA in the docs: https://help.github.com/en/articles/configuring-a-workflow#using-the-checkout-action

Might also benefit from a link to what $GITHUB_SHA is for different events.

All 8 comments

by default, checkout will run git fetch and git checkout $GITHUB_SHA

the ref input is for what ref to checkout, so you can do ref: refs/heads/master, ref: SHA or ref: tag

thanks! Sorry, GITHUB_SHA is what I meant, not GITHUB_REF.

Whom can I poke to maybe clarify that in the docs? Am I the only one for whom that wasn't obvious?

i will find someone on the doc team for this. :)

I've added a PR to amend the README.md accordingly: https://github.com/actions/checkout/pull/10

This should be closed now? :grin:

I still think it might help other users if this was briefly mentioned that by default, the action checks out $GITHUB_SHA in the docs: https://help.github.com/en/articles/configuring-a-workflow#using-the-checkout-action

Might also benefit from a link to what $GITHUB_SHA is for different events.

The link for what $GITHUB_SHA is now in the top-level readme file.

sounds like this is fixed now

Was this page helpful?
0 / 5 - 0 ratings