Update action.yml
This commit is contained in:
+9
-6
@@ -34,13 +34,16 @@ runs:
|
||||
HOST: ${{ inputs.host }}
|
||||
PORT: ${{ inputs.port }}
|
||||
run: |
|
||||
# 1. Setup the SSH directory and private key
|
||||
# 1. Setup the SSH directory
|
||||
mkdir -p ~/.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
|
||||
|
||||
# 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
|
||||
Host $HOST
|
||||
Port $PORT
|
||||
@@ -49,15 +52,15 @@ runs:
|
||||
StrictHostKeyChecking no
|
||||
EOF
|
||||
|
||||
# 3. Ensure workspace is empty before cloning
|
||||
# 4. Ensure workspace is empty before cloning
|
||||
cd $GITHUB_WORKSPACE
|
||||
find . -mindepth 1 -delete
|
||||
|
||||
# 4. Clone the repository
|
||||
# 5. Clone the repository
|
||||
echo "Cloning $REPO..."
|
||||
git clone ssh://git@$HOST:$PORT/$REPO.git .
|
||||
|
||||
# 5. Checkout the specific ref
|
||||
# 6. Checkout the specific ref
|
||||
if [ -n "$REF" ]; then
|
||||
echo "Checking out ref: $REF"
|
||||
git checkout "$REF"
|
||||
|
||||
Reference in New Issue
Block a user