new args: * target/working directory; * fetch tags on demand
This commit is contained in:
parent
1ab0381b17
commit
7fda4264f4
1 changed files with 14 additions and 0 deletions
|
|
@ -23,6 +23,14 @@ inputs:
|
|||
git_object_format:
|
||||
required: true
|
||||
default: sha256
|
||||
cwd:
|
||||
description: 'Create and change working dir before checkout'
|
||||
required: true
|
||||
default: '.'
|
||||
fetch_tags:
|
||||
description: 'Fetch tags after all'
|
||||
required: true
|
||||
default: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
|
@ -30,6 +38,8 @@ runs:
|
|||
- name: Run git checkout commands
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -vp "${{ inputs.cwd }}"
|
||||
cd "${{ inputs.cwd }}"
|
||||
shopt -s dotglob
|
||||
rm -rf *
|
||||
git init --object-format=${{ inputs.git_object_format }} -b main .
|
||||
|
|
@ -37,3 +47,7 @@ runs:
|
|||
export AH="Authorization: Basic $(printf 'x-access-token:${{ inputs.token }}' | base64 | tr -d '\n')"
|
||||
git --config-env=http.extraheader=AH fetch --depth 2 origin "${{ inputs.sha }}"
|
||||
git reset --hard FETCH_HEAD
|
||||
if [ ${{ inputs.fetch_tags }} == 'true' ]; then
|
||||
printf 'Fetching tags, as requested\n'
|
||||
git --config-env=http.extraheader=AH fetch --tags
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue