diff --git a/action.yaml b/action.yaml index 3b8f99a..aa509e4 100644 --- a/action.yaml +++ b/action.yaml @@ -63,6 +63,10 @@ inputs: artifact-name: type: string description: Name of artifact to upload, defaults to the autobuild package name + shallow: + type: boolean + description: Use shallow clone + default: false outputs: package-name: @@ -87,18 +91,18 @@ runs: steps: - name: Disable autocrlf shell: bash - env: - WINDOWS: ${{ runner.os == 'Windows' }} - run: | - if [[ $WINDOWS == 'true' ]]; then - git config --global core.autocrlf input - fi + if: runner.os == 'Windows' + run: git config --global core.autocrlf input - name: Checkout uses: actions/checkout@v4 if: inputs.checkout with: - fetch-depth: 0 # Fetch all history for SCM version + # Work around the fact that in the context of a pull request github.sha + # references a dynamic merge commit rather than the branch head + # https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: ${{ fromJSON(inputs.shallow) && 1 || 0 }} # Fetch all history for SCM version submodules: recursive - name: Create short SHA