2 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This article outlines how to manage the recent change in NPM's token policy, which limits token validity to 90 days. It introduces a tool called github-update-secret that automates the process of updating access tokens across multiple GitHub repositories. While the long-term solution is to adopt OIDC, this tool provides a temporary fix.
If you do, here's more
NPM's decision to revoke long-lived tokens and limit new tokens to 90 days creates challenges for developers using GitHub Actions to publish projects. Many developers, including the author, rely on these tokens for automated release processes. The transition to short-lived tokens demands regular updates, which can be cumbersome without an efficient solution.
To manage token rotation effectively, the author created a tool called `github-update-secret`. This tool automates the process of updating secrets across multiple repositories. By authenticating with a GitHub token, it fetches a list of all repositories where the user has admin access. Then it checks for the specified secret and updates its value if found. This is particularly useful for those who havenβt yet adopted OpenID Connect (OIDC) for trusted publishing, as they can continue using access tokens in the meantime.
In a practical example, the author successfully rotated their `NPM_TOKEN` across 27 repositories with a simple command. The process was quick, and by running the command with a debug flag, they could track which repositories were being updated in real-time. While the transition to OIDC is the ultimate goal for long-term security, `github-update-secret` provides a necessary workaround to keep development workflows moving smoothly during this change.
Questions about this article
No questions yet.