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:
Vital A Pi 2026-10-12 11:45:26 +03:00
commit 8abfeb98ce

View file

@ -4,7 +4,7 @@ name: 'Fast minimalist working copy checkout'
description: 'No tags, no history, no Node.js' description: 'No tags, no history, no Node.js'
inputs: inputs:
server_url: server-url:
description: 'Forgejo server URL' description: 'Forgejo server URL'
required: true required: true
default: ${{ forgejo.server_url }} default: ${{ forgejo.server_url }}
@ -12,25 +12,24 @@ inputs:
description: 'Repository path (owner/repo)' description: 'Repository path (owner/repo)'
required: true required: true
default: ${{ forgejo.repository }} default: ${{ forgejo.repository }}
sha: ref:
description: 'Commit SHA to checkout' description: 'Commit-ish to checkout'
required: true required: true
default: ${{ forgejo.sha }} default: ${{ forgejo.sha }}
token: token:
description: 'Forgejo token for authentication' description: 'Forgejo token for authentication'
required: true required: true
default: ${{ forgejo.token }} default: ${{ forgejo.token }}
git_object_format: git-object-format:
required: true required: true
default: sha256 default: sha256
cwd: cwd:
description: 'Create and change working dir before checkout' description: 'Create and change working dir before checkout'
required: true required: true
default: '.' default: '.'
fetch_tags: extra-fetch:
description: 'Fetch tags after all' description: 'Options line for additional git-fetch after all, e.g. "--unshallow"'
required: true required: false
default: false
runs: runs:
using: 'composite' using: 'composite'
@ -42,12 +41,14 @@ runs:
cd "${{ inputs.cwd }}" cd "${{ inputs.cwd }}"
shopt -s dotglob shopt -s dotglob
rm -rf * rm -rf *
git init --object-format=${{ inputs.git_object_format }} -b main . git init --object-format=${{ inputs.git-object-format }} -b main .
git remote add origin "${{ inputs.server_url }}/${{ inputs.repository }}.git" git remote add origin "${{ inputs.server-url }}/${{ inputs.repository }}.git"
export AH="Authorization: Basic $(printf 'x-access-token:${{ inputs.token }}' | base64 | tr -d '\n')" 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 git reset --hard FETCH_HEAD
if [ ${{ inputs.fetch_tags }} == 'true' ]; then if [[ -n '${{ inputs.extra-fetch }}' ]]; then
printf 'Fetching tags, as requested\n' read -r -a a1 <<< '${{ inputs.extra-fetch }}'
git --config-env=http.extraheader=AH fetch --tags a2=$(printf ' %q' "${a1[@]}")
printf 'Performing git-fetch with "%s"\n' "$a2"
git --config-env=http.extraheader=AH fetch $a2
fi fi