-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
38 lines (31 loc) · 989 Bytes
/
entrypoint.sh
File metadata and controls
38 lines (31 loc) · 989 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
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e
# Required environment variables:
# RUNNER_TOKEN - GitHub Actions runner registration token
# RUNNER_URL - Repository or organization URL (default: Weaver.Backend)
# RUNNER_NAME - Name for this runner (default: hostname)
# RUNNER_LABELS - Comma-separated labels (default: self-hosted)
RUNNER_URL="${RUNNER_URL:-https://github.com/XXXX/XXXX}"
RUNNER_NAME="${RUNNER_NAME:-$(hostname)}"
RUNNER_LABELS="${RUNNER_LABELS:-self-hosted}"
if [ -z "$RUNNER_TOKEN" ]; then
echo "ERROR: RUNNER_TOKEN environment variable is required."
exit 1
fi
cd /home/runner/actions-runner
# Configure the runner
./config.sh \
--url "$RUNNER_URL" \
--token "$RUNNER_TOKEN" \
--name "$RUNNER_NAME" \
--labels "$RUNNER_LABELS" \
--unattended \
--replace
# Cleanup registration on container stop
cleanup() {
echo "Removing runner..."
./config.sh remove --token "$RUNNER_TOKEN"
}
trap cleanup EXIT INT TERM
# Start the runner
./run.sh