Skip to content

Commit

Permalink
Add shallow option to perform depth: 1 checkout
Browse files Browse the repository at this point in the history
Allow consuming repositories to elect to perform a shallow (depth: 1)
checkout rather than the full depth: 0 checkout.
  • Loading branch information
bennettgoble committed Mar 31, 2024
1 parent 4659c32 commit 691ef9b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -87,12 +91,8 @@ 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
Expand All @@ -102,7 +102,7 @@ runs:
# 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: 0 # Fetch all history for SCM version
fetch-depth: ${{ fromJSON(inputs.shallow) && 1 || 0 }} # Fetch all history for SCM version
submodules: recursive

- name: Create short SHA
Expand Down

0 comments on commit 691ef9b

Please sign in to comment.