Skip to content

Commit 870ddf0

Browse files
author
Graham Krizek
committed
Add git example
1 parent 54040b0 commit 870ddf0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

example-git.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
handler () {
3+
set -e
4+
5+
EVENT_DATA=$1
6+
echo $EVENT_DATA
7+
8+
REPO=$(echo $EVENT_DATA | jq ."repository")
9+
mkdir -p /tmp/.ssh
10+
aws s3 cp s3://bucket/id_rsa /tmp/.ssh/id_rsa
11+
chmod 400 /tmp/.ssh/id_rsa
12+
eval `ssh-agent -s`
13+
export GIT_SSH="/tmp"
14+
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/tmp/.ssh/known_hosts -i /tmp/.ssh/id_rsa"
15+
ssh-add /tmp/.ssh/id_rsa 2>&1
16+
ssh-keyscan github.com >> /tmp/.ssh/known_hosts 2>&1
17+
git clone ssh://git@github.com/owner/repo.git /tmp/repo 2>&1
18+
ls -al /tmp/repo
19+
20+
echo "Successfully cloned repository" >&2
21+
}

0 commit comments

Comments
 (0)