diff --git a/.github/npm-token-expiry.txt b/.github/npm-token-expiry.txt deleted file mode 100644 index 275e85e..0000000 --- a/.github/npm-token-expiry.txt +++ /dev/null @@ -1 +0,0 @@ -2026-08-26 diff --git a/.github/workflows/check-npm-token.yml b/.github/workflows/check-npm-token.yml deleted file mode 100644 index 714434a..0000000 --- a/.github/workflows/check-npm-token.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: NPM token expiry check - -on: - schedule: - - cron: '0 9 * * *' - workflow_dispatch: - -permissions: - contents: read - issues: write - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Open or update rotation issue when within threshold - env: - GH_TOKEN: ${{ github.token }} - THRESHOLD_DAYS: '14' - run: | - set -e - expiry=$(tr -d '[:space:]' < .github/npm-token-expiry.txt) - now_epoch=$(date -u +%s) - expiry_epoch=$(date -u -d "$expiry" +%s) - days_left=$(( (expiry_epoch - now_epoch) / 86400 )) - echo "NPM_TOKEN expires $expiry — $days_left days from now." - - if [ "$days_left" -gt "$THRESHOLD_DAYS" ]; then - echo "Above threshold ($THRESHOLD_DAYS d); nothing to do." - exit 0 - fi - - marker='' - existing=$(gh issue list --repo "$GITHUB_REPOSITORY" \ - --state open --search "$marker in:body" \ - --json number --jq '.[0].number // empty') - - title="Rotate NPM_TOKEN — expires $expiry ($days_left days left)" - body=$(cat <' | gh secret set NPM_TOKEN --repo $GITHUB_REPOSITORY - \`\`\` - 3. Bump the expiry date in \`.github/npm-token-expiry.txt\` and commit on \`main\`. - 4. Revoke the previous token on npmjs.com. - 5. Close this issue. - - _This issue is created and refreshed daily by \`.github/workflows/check-npm-token.yml\` while \`days_left <= $THRESHOLD_DAYS\`._ - EOF - ) - - if [ -n "$existing" ]; then - echo "Updating issue #$existing" - gh issue edit "$existing" --repo "$GITHUB_REPOSITORY" --title "$title" --body "$body" - else - echo "Opening new rotation issue" - gh issue create --repo "$GITHUB_REPOSITORY" --title "$title" --body "$body" - fi