35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
name: "Git clone source"
|
|
description: "Clone branch, tag or commit to working directory"
|
|
author: "Daniel Demus"
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- id: entrypoint
|
|
name: Clone source
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
|
|
echo 'Server ${{ gitea.server_url }}'
|
|
echo 'Repo ${{ gitea.repository }}'
|
|
echo 'Ref ${{ gitea.ref }}'
|
|
echo 'Name ${{ gitea.ref_name }}'
|
|
echo 'Type ${{ gitea.ref_type }}'
|
|
|
|
cd ${{ gitea.workspace }}
|
|
git config set --global advice.detachedHead false
|
|
if [ -z "${{ gitea.ref_name }}" ]; then
|
|
echo "Initing, fetching and checking out"
|
|
git init -b main
|
|
git remote add origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
|
|
git fetch --depth 1 origin ${{ gitea.sha }}
|
|
git checkout FETCH_HEAD
|
|
else
|
|
git clone -b ${{ gitea.ref_name }} --single-branch ${{ gitea.server_url }}/${{ gitea.repository }}.git .
|
|
fi
|
|
|
|
echo "The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
branding:
|
|
icon: "git-commit"
|
|
color: "gray-dark"
|