Skip to content

Commit 8f0b3ed

Browse files
author
Graham Krizek
committed
Update git example
1 parent e344ad0 commit 8f0b3ed

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

examples/example-git.sh

100644100755
+6-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ handler () {
55
EVENT_DATA=$1
66
echo $EVENT_DATA
77

8-
REPO=$(echo $EVENT_DATA | jq ."repository")
8+
REPO=$(echo $EVENT_DATA | jq -r ."repository")
9+
OWNER=$(echo $EVENT_DATA | jq -r ."owner")
10+
BUCKET=$(echo $EVENT_DATA | jq -r ."bucket")
911
mkdir -p /tmp/.ssh
10-
aws s3 cp s3://bucket/id_rsa /tmp/.ssh/id_rsa
12+
aws s3 cp s3://$BUCKET/id_rsa /tmp/.ssh/id_rsa
1113
chmod 400 /tmp/.ssh/id_rsa
1214
eval `ssh-agent -s`
1315
export GIT_SSH="/tmp"
1416
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/tmp/.ssh/known_hosts -i /tmp/.ssh/id_rsa"
1517
ssh-add /tmp/.ssh/id_rsa 2>&1
1618
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+
git clone ssh://git@github.com/$OWNER/$REPO.git /tmp/$REPO 2>&1
20+
ls -al /tmp/$REPO
1921

2022
echo "Successfully cloned repository" >&2
2123
}

0 commit comments

Comments
 (0)