Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Allow null branch value
Browse files Browse the repository at this point in the history
  • Loading branch information
randy-sab-roy committed Oct 28, 2022
1 parent e356e87 commit aad1c01
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ inputs:
required: true
branch:
description: The branch to checkout.
default: ${GITHUB_REF/#refs\/heads\//}
required: true
required: false

runs:
using: "composite"
Expand All @@ -19,8 +18,10 @@ runs:
run: |
REPO="https://${GITHUB_ACTOR}:${{ github.token }}@github.com/${GITHUB_REPOSITORY}.git"
BRANCH="${{ inputs.branch }}"
DEFAULT_BRANCH="${GITHUB_REF/#refs\/heads\//}"
REF="${BRANCH:-$DEFAULT_BRANCH}"
git clone --filter=blob:none --no-checkout --depth 1 --sparse $REPO .
git sparse-checkout init --cone
git sparse-checkout init --cone --sparse-index
git sparse-checkout set ${{ inputs.patterns }}
git fetch --no-tags --prune --depth=1 origin $BRANCH
git checkout $BRANCH
git fetch --progress --no-tags --prune --depth=1 origin $REF:$REF
git checkout --progress $REF

0 comments on commit aad1c01

Please sign in to comment.