Add action.yml
This commit is contained in:
25
action.yml
Normal file
25
action.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: checkout
|
||||||
|
description: Node-free checkout for Gitea Actions using preinstalled git.
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: Branch, tag, or commit to fetch (defaults to current workflow commit)
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- shell: sh
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ github.token }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
REF: ${{ inputs.ref || github.sha }}
|
||||||
|
SERVER_URL: ${{ github.server_url }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
BASE="${SERVER_URL:-${GITEA_SERVER_URL:-}}"
|
||||||
|
[ -n "$BASE" ] || { echo "Missing server_url"; exit 1; }
|
||||||
|
git init "$GITHUB_WORKSPACE"
|
||||||
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
git remote add origin "${BASE%/}/${REPO}.git"
|
||||||
|
git -c http.extraHeader="Authorization: token $TOKEN" fetch --depth=1 origin "$REF"
|
||||||
|
git checkout FETCH_HEAD
|
||||||
Reference in New Issue
Block a user