Compare commits
2
Commits
4ad8d15730
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abfcc1f965 | ||
|
|
4fea231b5f |
+8
-8
@@ -37,11 +37,11 @@ runs:
|
|||||||
# 1. Setup the SSH directory
|
# 1. Setup the SSH directory
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
chmod 700 ~/.ssh
|
chmod 700 ~/.ssh
|
||||||
|
|
||||||
# 2. Decode the Base64 secret back into a properly formatted file
|
# 2. Write the private key to a file as-is
|
||||||
echo "$SSH_KEY" | base64 --decode > ~/.ssh/gitea_key
|
printf '%s\n' "$SSH_KEY" > ~/.ssh/gitea_key
|
||||||
chmod 600 ~/.ssh/gitea_key
|
chmod 600 ~/.ssh/gitea_key
|
||||||
|
|
||||||
# 3. 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
|
||||||
@@ -50,19 +50,19 @@ runs:
|
|||||||
IdentityFile ~/.ssh/gitea_key
|
IdentityFile ~/.ssh/gitea_key
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 4. 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
|
||||||
|
|
||||||
# 5. 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 .
|
||||||
|
|
||||||
# 6. 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"
|
||||||
else
|
else
|
||||||
echo "No Ref provided to checkout!"
|
echo "No Ref provided to checkout!"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user