Skip to content

Reg token is only valid for short period #6

Description

@sdfgeoff

The registration token can only be used to unregister the runner for a short period. After that time, it has expired and the runner will not remove itself on tear-down.

The solution is to get a remove-runner token:

cleanup() {
  echo "Removing runner..."

  echo "Requesting remove token..."
  REM_TOKEN=$(curl --fail -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/orgs/${ORG}/actions/runners/remove-token | jq .token --raw-output)

  # If REM_TOKEN is null or empty, exit with error
  if [ -z "$REM_TOKEN" ] || [ "$REM_TOKEN" == "null" ]; then
    echo "Failed to obtain registration token. Exiting."
    exit 1
  fi

  ./config.sh remove --token ${REM_TOKEN}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions