Skip to content

Make checked out ref available to other steps #281

@jwgmeligmeyling

Description

@jwgmeligmeyling

Pull requests events by default check out the merge commit ref. Alternatively, the pull request head can be checkout using:

- uses: actions/checkout@v2
  with:
    ref: ${{ github.event.pull_request.head.sha }}

However, in successive actions it is not possible to detect whether the action uses another ref. github.context.sha still references the merge commit. See for example the discussion on: jwgmeligmeyling/pmd-github-action#2

It would be nice if actions/checkout@v2 somehow made the checkout ref available as output or exported variable.

Or am I overlooking an existing approach to obtain the checked out commit SHA?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions