JoshuaKGoldberg / JoshuaKGoldberg/prune-github-notifications

🐛 Bug: --watch mode eventually crashes with no gh auth token

Open
#180 2 comments 1 reaction 0 assignees View on GitHub
status: accepting prs type: bug
Dominant language
TypeScript
Stars
7
Forks
0
Avg merge
12m
Merged PRs (30d)
35

Description

### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/prune-github-notifications/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

When you run `npx prune-github-notifications --watch 100`, it should run forever. Infinitely. Never stopping.

### Actual

Eventually, I think the `gh auth token` expires in some way. I've been consistently getting crashes like:

```plaintext
npx prune-github-notifications --watch 100
Running prune-github-notifications with --watch 100...
[2024-06-10T11:49:31.445Z] Pruned 44 threads.
[2024-06-10T11:51:20.928Z] Pruned 5 threads.

...

[2024-06-11T08:44:32.969Z] No threads found.
[2024-06-11T08:46:18.985Z] No threads found.
Failed to run prune-github-notifications: Error: Command failed: gh auth token
no oauth token

at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1105:16)
at Socket. (node:internal/child_process:457:11)
at Socket.emit (node:events:518:28)
at Pipe. (node:net:337:12) {
code: 1,
killed: false,
signal: null,
cmd: 'gh auth token',
stdout: '',
stderr: 'no oauth token\n'
}
```

### Additional Info

I think the CLI will need to re-run `gh auth token` to get a new token when the old one expires.

💖

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.