await-github-file-change-cli
Version:
CLI tool to monitor GitHub file changes by polling for etag changes
66 lines (41 loc) • 1.35 kB
Markdown
A CLI tool that monitors a GitHub file for changes by polling its etag value. The tool will continuously check the file every second until it detects a change, then exit.
You can run this tool directly using `npx` without installing it:
```bash
npx await-github-file-change-cli https://github.com/owner/repo/blob/branch/path/to/file
```
```bash
npx await-github-file-change-cli https://github.com/gr2m/sandbox/blob/main/test-file
```
For higher rate limits and access to private repositories, set the `GITHUB_TOKEN` environment variable:
```bash
GITHUB_TOKEN=your_token_here npx await-github-file-change-cli https://github.com/owner/repo/blob/branch/path/to/file
```
1. Parses the GitHub URL to extract owner, repository, and file path
2. Fetches the initial etag value using a HEAD request
3. Polls the file every second with HEAD requests
4. When the etag changes, logs the new etag and exits
If you want to install it globally:
```bash
npm install -g await-github-file-change-cli
```
Then use it directly:
```bash
await-github-file-change https://github.com/owner/repo/blob/branch/path/to/file
```
```bash
npm install
```
```bash
npm test
```
[](LICENSE)