Skip to content

Commit f2d17a8

Browse files
committed
feat: use ssh key
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
1 parent cfe0d74 commit f2d17a8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

script.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ if [ -z "${GH_EMAIL}" ]; then
1818
echo "GH_EMAIL is not set"
1919
exit 1
2020
fi
21+
if [ -z "${GH_SSH_KEY}" ]; then
22+
echo "GH_SSH_KEY is not set"
23+
exit 1
24+
fi
2125

2226
cd "$(mktemp -d)"
2327
dir_path="$(pwd)"
2428
trap "rm -rf ${dir_path}" EXIT
25-
git clone "${GH_REPOSITORY}" "repo"
29+
echo "${GH_SSH_KEY}" > ssh_key
30+
chmod 600 ssh_key
31+
GIT_SSH_COMMAND="ssh -i ${dir_path}/ssh_key" git clone "${GH_REPOSITORY}" "repo"
2632
cd "repo"
2733

2834
git config user.name "${GH_USERNAME}"
@@ -51,7 +57,7 @@ do
5157
fi
5258
done
5359

54-
git push origin HEAD
60+
GIT_SSH_COMMAND="ssh -i ${dir_path}/ssh_key" git push origin HEAD
5561

5662
echo
5763
echo "Done ! Added ${commits} commits"

0 commit comments

Comments
 (0)