feat: Add support for GitLab Token rotation
Adds a new GitLab Token rotation command.
rotate gitlab <tag>
Uses the GitLab Token rotation API to rotate a token. By default, the new token will have an expiry 1 day less than 1 year into the future.
$ pmv rotate gitlab "MyTag"
pmv: 🔓 Fetching 1password items tag=Dedicated/Sandbox/GitLab.com/PAT:Personal
pmv: 🧩 Loaded item title="GitLab Access Token: GitLab.com PAT for Sandbox Access (api): https://gitlab.com: andrewn"
pmv: 🔓 Complete, loaded items...
pmv: 🔑 Rotating token in GitLab...
pmv: 🔑 New token expiry date... expires_at=2025-05-16
pmv: 🐣 Creating new 1password item...
pmv: 🐣 Created item link=https://start.1password.com/open/...
pmv: 🗑️ Deleting old 1password item.
pmv: 🚀 Rotation complete...
- Unfortunately this can only be used for Personal Access Tokens at present, until gitlab-org/gitlab#462419 (closed) is resolved.
- Use the
--expires
argument to set an expiry. This can either be a date inYYYY-MM-DD
format, for a duration, eg:30d
.
Edited by Andrew Newdigate