Skip to content

Self Hosted Runner token can expire before removal #241

Open
@hato1883

Description

@hato1883

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.

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