Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self Hosted Runner token can expire before removal #241

Open
hato1883 opened this issue Oct 18, 2024 · 0 comments
Open

Self Hosted Runner token can expire before removal #241

hato1883 opened this issue Oct 18, 2024 · 0 comments

Comments

@hato1883
Copy link

The token given by the registration endpoint is only valid for about 1 hour.
After this time limit the removal will fail (not remove runner from repository).

To fix this you need to change the removal step to something along the lines of:

remove() {
    removal_url="https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPOSITORY}/actions/runners/remove-token"
    echo "Requesting removal TOKEN at '${removal_url}'" # optional
    payload=$(curl -sX POST -H "Authorization: token ${GITHUB_PERSONAL_TOKEN}" ${removal_url})
    RUNNER_REMOVAL_TOKEN=$(echo $payload | jq .token --raw-output)
    ./config.sh remove --token "${RUNNER_REMOVAL_TOKEN}"
}

This will make sure that you will always have a valid token when removing the runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant