Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/actions/wsl-checkout/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Azure WSL repo clone
description: 'Clones your repo into WSL.'
description: "Clones your repo into WSL."

inputs:
distro:
Expand All @@ -13,9 +13,13 @@ inputs:
description: Whether to fetch submodules or not
required: false
default: "false"
token:
description: GitHub access token used to fetch the repository. This is required for checking out private repositories. The token will persist in the git config of the checked out repository and is not cleaned up automatically.
required: false
default: ""

runs:
using: 'composite'
using: "composite"
steps:
- name: Clone repo
uses: ubuntu/WSL/.github/actions/wsl-bash@main
Expand All @@ -27,12 +31,17 @@ runs:
export GIT_TERMINAL_PROMPT=0

mkdir -p ${{ inputs.working-dir }}
git clone --quiet --depth 1 https://github.com/${{ github.repository }}.git ${{ inputs.working-dir }}

CLONE_URL="https://github.com/${{ github.repository }}.git"
if [ -n "${{ inputs.token }}" ] ; then
CLONE_URL="https://x-access-token:${{ inputs.token }}@github.com/${{ github.repository }}.git"
fi
git clone --quiet --depth 1 "$CLONE_URL" ${{ inputs.working-dir }}

cd ${{ inputs.working-dir }}
git fetch --quiet --depth 1 --no-tags --prune --update-head-ok origin +${{ github.sha }}:${{ github.ref }}
git checkout --quiet ${{ github.sha }}

if [ "${{ inputs.submodules }}" = true ] ; then
git submodule --quiet update --init --recursive --depth 1
fi
fi
Loading