Get notifications when a token is about to expire soon
Context
We don't receive any notifications when project access tokens are about to expire.
Goal
Receive notifications (in Slack or email) about tokens that should be rotated soon.
Technical considerations
The following command works well to retrieve the expiration dates (we just need to have a token to access it):
$ curl -s --header "PRIVATE-TOKEN: ${GITLAB_API_PRIVATE_TOKEN}" https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/access_tokens | jq -r '.[] | .expires_at + " - " + .name' | sort
Edited by David Dieulivol