Update action.yml

This commit is contained in:
megamiley
2026-06-15 13:09:54 +00:00
parent d100da824c
commit 8d1fc8be59
+9 -6
View File
@@ -34,13 +34,16 @@ runs:
HOST: ${{ inputs.host }} HOST: ${{ inputs.host }}
PORT: ${{ inputs.port }} PORT: ${{ inputs.port }}
run: | run: |
# 1. Setup the SSH directory and private key # 1. Setup the SSH directory
mkdir -p ~/.ssh mkdir -p ~/.ssh
chmod 700 ~/.ssh chmod 700 ~/.ssh
echo "$SSH_KEY" > ~/.ssh/gitea_key
# 2. Safely write the private key and force a trailing newline
cat <<< "$SSH_KEY" > ~/.ssh/gitea_key
echo "" >> ~/.ssh/gitea_key
chmod 600 ~/.ssh/gitea_key chmod 600 ~/.ssh/gitea_key
# 2. Configure SSH for the custom port and bypass host key prompt # 3. Configure SSH for the custom port and bypass host key prompt
cat >> ~/.ssh/config <<EOF cat >> ~/.ssh/config <<EOF
Host $HOST Host $HOST
Port $PORT Port $PORT
@@ -49,15 +52,15 @@ runs:
StrictHostKeyChecking no StrictHostKeyChecking no
EOF EOF
# 3. Ensure workspace is empty before cloning # 4. Ensure workspace is empty before cloning
cd $GITHUB_WORKSPACE cd $GITHUB_WORKSPACE
find . -mindepth 1 -delete find . -mindepth 1 -delete
# 4. Clone the repository # 5. Clone the repository
echo "Cloning $REPO..." echo "Cloning $REPO..."
git clone ssh://git@$HOST:$PORT/$REPO.git . git clone ssh://git@$HOST:$PORT/$REPO.git .
# 5. Checkout the specific ref # 6. Checkout the specific ref
if [ -n "$REF" ]; then if [ -n "$REF" ]; then
echo "Checking out ref: $REF" echo "Checking out ref: $REF"
git checkout "$REF" git checkout "$REF"