breaking input changes: overhauled semantics and renamed
* fetch_tags (semantics) -> extra-fetch -- now accepts arbitrary fetch args * sha -> ref -- renamed to reflect that it accepts a commit-ish object in fact * also restyled: server_url -> server-url, git_object_format -> git-object-format
This commit is contained in:
parent
7fda4264f4
commit
8abfeb98ce
1 changed files with 15 additions and 14 deletions
|
|
@ -4,7 +4,7 @@ name: 'Fast minimalist working copy checkout'
|
|||
description: 'No tags, no history, no Node.js'
|
||||
|
||||
inputs:
|
||||
server_url:
|
||||
server-url:
|
||||
description: 'Forgejo server URL'
|
||||
required: true
|
||||
default: ${{ forgejo.server_url }}
|
||||
|
|
@ -12,25 +12,24 @@ inputs:
|
|||
description: 'Repository path (owner/repo)'
|
||||
required: true
|
||||
default: ${{ forgejo.repository }}
|
||||
sha:
|
||||
description: 'Commit SHA to checkout'
|
||||
ref:
|
||||
description: 'Commit-ish to checkout'
|
||||
required: true
|
||||
default: ${{ forgejo.sha }}
|
||||
token:
|
||||
description: 'Forgejo token for authentication'
|
||||
required: true
|
||||
default: ${{ forgejo.token }}
|
||||
git_object_format:
|
||||
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
|
||||
extra-fetch:
|
||||
description: 'Options line for additional git-fetch after all, e.g. "--unshallow"'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
|
@ -42,12 +41,14 @@ runs:
|
|||
cd "${{ inputs.cwd }}"
|
||||
shopt -s dotglob
|
||||
rm -rf *
|
||||
git init --object-format=${{ inputs.git_object_format }} -b main .
|
||||
git remote add origin "${{ inputs.server_url }}/${{ inputs.repository }}.git"
|
||||
git init --object-format=${{ inputs.git-object-format }} -b main .
|
||||
git remote add origin "${{ inputs.server-url }}/${{ inputs.repository }}.git"
|
||||
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 --config-env=http.extraheader=AH fetch --depth 2 origin "${{ inputs.ref }}"
|
||||
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
|
||||
if [[ -n '${{ inputs.extra-fetch }}' ]]; then
|
||||
read -r -a a1 <<< '${{ inputs.extra-fetch }}'
|
||||
a2=$(printf ' %q' "${a1[@]}")
|
||||
printf 'Performing git-fetch with "%s"\n' "$a2"
|
||||
git --config-env=http.extraheader=AH fetch $a2
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue