fix: use GITEA_TOKEN for git clone authentication in workflows
- Add GITEA_TOKEN secret support for HTTPS git clone - Fallback to public access if token not available - Fixes checkout failures when runner has no git credentials - Required for native workflows without actions/checkout
This commit is contained in:
@@ -24,15 +24,21 @@ jobs:
|
|||||||
REF_NAME="main"
|
REF_NAME="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git clone --depth 1 --branch "$REF_NAME" \
|
# Use Gitea token if available, otherwise try public access
|
||||||
"https://git.michaelschiemer.de/${REPO}.git" \
|
if [ -n "${{ secrets.GITEA_TOKEN }}" ]; then
|
||||||
/workspace/repo || \
|
git clone --depth 1 --branch "$REF_NAME" \
|
||||||
git clone --depth 1 --branch "$REF_NAME" \
|
"https://${{ secrets.GITEA_TOKEN }}@git.michaelschiemer.de/${REPO}.git" \
|
||||||
"git@git.michaelschiemer.de:${REPO}.git" \
|
/workspace/repo
|
||||||
/workspace/repo || \
|
else
|
||||||
git clone --depth 1 \
|
# Try public HTTPS (works if repository is public)
|
||||||
"https://git.michaelschiemer.de/${REPO}.git" \
|
git clone --depth 1 --branch "$REF_NAME" \
|
||||||
/workspace/repo
|
"https://git.michaelschiemer.de/${REPO}.git" \
|
||||||
|
/workspace/repo || \
|
||||||
|
# Fallback: Try to use Gitea's internal runner access
|
||||||
|
git clone --depth 1 \
|
||||||
|
"https://git.michaelschiemer.de/${REPO}.git" \
|
||||||
|
/workspace/repo
|
||||||
|
fi
|
||||||
|
|
||||||
cd /workspace/repo
|
cd /workspace/repo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user