Skip to content

Instantly share code, notes, and snippets.

@CreedsCode
Created August 12, 2021 07:10
Show Gist options
  • Save CreedsCode/3134e494fe62c5d55b2d66f3c95e2809 to your computer and use it in GitHub Desktop.
Save CreedsCode/3134e494fe62c5d55b2d66f3c95e2809 to your computer and use it in GitHub Desktop.
start.sh for github runner, to be able to curl it in the dockerfile
#!/bin/bash
ORGANIZATION=$ORGANIZATION
ACCESS_TOKEN=$ACCESS_TOKEN
REG_TOKEN=$(curl -sX POST -H "Authorization: token ${ACCESS_TOKEN}" https://api.github.com/orgs/${ORGANIZATION}/actions/runners/registration-token | jq .token --raw-output)
cd /home/docker/actions-runner
./config.sh --url https://github.com/${ORGANIZATION} --token ${REG_TOKEN}
cleanup() {
echo "Removing runner..."
./config.sh remove --unattended --token ${REG_TOKEN}
}
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM
./run.sh & wait $!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment