53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
# SPDX-FileCopyrightText: 2026 Vital A Pi <code@vp.ag>
|
|
# SPDX-License-Identifier: MIT
|
|
name: 'Fast minimalist working copy checkout'
|
|
description: 'No tags, no history, no Node.js'
|
|
|
|
inputs:
|
|
server_url:
|
|
description: 'Forgejo server URL'
|
|
required: true
|
|
default: ${{ forgejo.server_url }}
|
|
repository:
|
|
description: 'Repository path (owner/repo)'
|
|
required: true
|
|
default: ${{ forgejo.repository }}
|
|
sha:
|
|
description: 'Commit SHA to checkout'
|
|
required: true
|
|
default: ${{ forgejo.sha }}
|
|
token:
|
|
description: 'Forgejo token for authentication'
|
|
required: true
|
|
default: ${{ forgejo.token }}
|
|
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'
|
|
steps:
|
|
- 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 .
|
|
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 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
|