-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
25 lines (19 loc) · 842 Bytes
/
start.sh
File metadata and controls
25 lines (19 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
ORGANIZATION=$ORGANIZATION
REPO=$REPO
ACCESS_TOKEN=$ACCESS_TOKEN
cd /home/docker/actions-runner
if [ -z "$REPO" ]; then
REG_TOKEN=$(curl -sX POST -H "Authorization: token ${ACCESS_TOKEN}" https://api.github.com/orgs/${ORGANIZATION}/actions/runners/registration-token | jq .token --raw-output)
./config.sh --url https://github.com/${ORGANIZATION} --token ${REG_TOKEN}
else
REG_TOKEN=$(curl -sX POST -H "Authorization: token ${ACCESS_TOKEN}" https://api.github.com/repos/${ORGANIZATION}/${REPO}/actions/runners/registration-token | jq .token --raw-output)
./config.sh --url https://github.com/${ORGANIZATION}/${REPO} --token ${REG_TOKEN}
fi
cleanup() {
echo "Removing runner..."
./config.sh remove --unattended --token ${REG_TOKEN}
}
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM
./run.sh & wait $!