Test env context #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test actions/checkout ref expansion | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
type: string | |
default: main | |
description: "The branch, tag, or SHA to checkout" | |
jobs: | |
run: | |
name: Test actions/checkout ref expansion | |
runs-on: ubuntu-latest | |
steps: | |
- name: Resolve inputs.ref to full SHA | |
id: resolve-ref | |
# https://github.com/actions/checkout/issues/265 | |
run: | | |
sha=$(gh api /repos/$GITHUB_REPOSITORY/commits/${{ inputs.ref }} | jq -r .sha) | |
echo "sha=$sha" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.resolve-ref.outputs.sha }} | |
- name: Verify checked out commit | |
run: git log -1 |