Clone branch if there is a ref_name
This commit is contained in:
+13
-4
@@ -10,11 +10,20 @@ runs:
|
||||
run: |
|
||||
set -e
|
||||
|
||||
echo 'Ref ${{ gitea.ref }}'
|
||||
echo 'Name ${{ gitea.ref_name }}'
|
||||
echo 'Type ${{ gitea.ref_type }}'
|
||||
|
||||
cd ${{ gitea.workspace }}
|
||||
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
|
||||
if [ -z "${{ gitea.ref_name }}" ]; then
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user