Skip to content

Commit c80145d

Browse files
committed
fix: ssh private key handling
1 parent 1b02700 commit c80145d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

entrypoint.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ if [[ -z "$GITHUB_TOKEN" ]]; then
77
exit 1
88
fi
99

10-
if [[ -z "$SSH_PRIVATE_KEY" ]]; then
10+
if [[ ! -z "$SSH_PRIVATE_KEY" ]]; then
11+
echo "Saving SSH_PRIVATE_KEY"
12+
1113
mkdir -p /root/.ssh
1214
echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
1315
chmod 600 /root/.ssh/id_rsa
14-
fi
1516

16-
# Github action changes $HOME to /github at runtime
17-
# therefore we always copy the SSH key to $HOME (aka. ~)
18-
mkdir -p ~/.ssh
19-
cp /root/.ssh/* ~/.ssh/ 2> /dev/null || true
17+
# Github action changes $HOME to /github at runtime
18+
# therefore we always copy the SSH key to $HOME (aka. ~)
19+
mkdir -p ~/.ssh
20+
cp /root/.ssh/* ~/.ssh/ 2> /dev/null || true
21+
fi
2022

2123
sh -c "/github-sync.sh $*"

0 commit comments

Comments
 (0)