{"_id":"@alexmchan/watch-github-job","name":"@alexmchan/watch-github-job","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.2":{"name":"@alexmchan/watch-github-job","version":"1.0.2","description":"Watch a GitHub Actions run until it completes","type":"module","bin":{"watch-github-job":"dist/watch-github-job.js"},"scripts":{"build":"bun build src/index.ts --target=node --outfile dist/watch-github-job.js && chmod +x dist/watch-github-job.js","prepublishOnly":"npm run build","publish:npm":"npm publish --access public","release":"npm version patch && npm publish --access public","release:minor":"npm version minor && npm publish --access public","release:major":"npm version major && npm publish --access public","dev":"bun run src/index.ts","link":"npm link"},"dependencies":{"@commander-js/extra-typings":"^13.1.0","@clack/prompts":"^0.10.0"},"publishConfig":{"access":"public"},"devDependencies":{"@types/node":"^22.0.0","bun-types":"latest"},"_id":"@alexmchan/watch-github-job@1.0.2","gitHead":"527ec245b0f83e054b5f8bf843936bd3ae81e308","_nodeVersion":"22.14.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-0yn9Odf171B79/2xZTZaQK/VsowVAiUX6xstZ1u9PUQmT8QBX2b95chcUnk4Qc+ZrL+rbZzxaw99RDVHoc3ojQ==","shasum":"9aa4425f646f01e75ba43162a856ee44c4b19336","tarball":"https://registry.npmjs.org/@alexmchan/watch-github-job/-/watch-github-job-1.0.2.tgz","fileCount":3,"unpackedSize":88242,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDmkvr/LMSHG/1rOJybUbKahes5b3hSgK/IZTfQ/2+9bwIgb4Di0H3QywtOXK3FcWLILQ4CCWLLLsZ4ZTrC87DzRUk="}]},"_npmUser":{"name":"alexanderchan","email":"alexander.m.chan@gmail.com"},"directories":{},"maintainers":[{"name":"alexanderchan","email":"alexander.m.chan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/watch-github-job_1.0.2_1773156011368_0.32520526074538125"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-10T15:20:11.275Z","1.0.2":"2026-03-10T15:20:11.582Z","modified":"2026-03-10T15:20:11.841Z"},"maintainers":[{"name":"alexanderchan","email":"alexander.m.chan@gmail.com"}],"description":"Watch a GitHub Actions run until it completes","readme":"# watch-github-job\n\nWatches a GitHub Actions run in your terminal until it completes, then opens the browser. Auto-detects the relevant run from your current branch so you don't have to copy-paste URLs.\n\n## Usage\n\n```bash\n# Auto-detect from current branch (prefers CI, then Deploy)\nwatch-github-job\n\n# Watch a specific run by ID or URL\nwatch-github-job 22412559223\nwatch-github-job https://github.com/org/repo/actions/runs/22412559223\n\n# Override workflow priority filters\nwatch-github-job --text \"Build,Test\"\n\n# Don't open browser on completion\nwatch-github-job --no-open\n\n# Longer timeout\nwatch-github-job --timeout 60\n\n# Minimal output for AI agents (no intermediate status lines)\nwatch-github-job --quiet --no-open\n```\n\nWhile watching, it prints a single updating status line:\n\n```\n⏳ in_progress    step: Run unit tests (shard 1/3)            elapsed: 8m42s\n```\n\nElapsed time is measured from when the job actually started (not when you ran the command), so attaching mid-run shows the real duration.\n\nOn completion it prints the conclusion and opens the run in your browser:\n\n```\n✅ success  elapsed: 12m4s\n```\n\nExits `0` on success, `1` on failure or timeout.\n\n## How run detection works\n\nWhen no run ID is provided, it tries two strategies in order:\n\n**1. Latest run for current branch**\n\n- Gets the current git branch\n- Looks up the open PR for that branch to get its head SHA\n- Fetches the 50 most recent runs on the branch\n- If runs exist on the exact PR SHA, scopes to those; otherwise uses all branch runs\n- Picks the first run whose name matches a priority filter (see below)\n\n**2. Active runs by current user** (fallback if no branch run is found)\n\n- Gets your GitHub username via `gh api user`\n- Collects runs with status `in_progress`, `queued`, and `waiting`\n- Picks by priority filter from the combined list\n\n## Priority filters\n\nThe `--text` option takes a comma-delimited list of workflow name patterns tried in order. The first match wins. If nothing matches, it falls back to the first run found regardless of name.\n\nDefault: `CI,Deploy`\n\nExamples:\n- `--text \"CI\"` — only match CI\n- `--text \"Build,CI,Deploy\"` — prefer Build, then CI, then Deploy\n- `--text \"\"` — match any workflow (first run found)\n\nPatterns are case-insensitive regular expressions, so `\"CI\"` matches `\"CI / lint\"`, `\"CI checks\"`, etc.\n\n## Options\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `--text <filters>` | `CI,Deploy` | Priority-ordered comma-delimited workflow name filters |\n| `--no-open` | — | Don't open browser when run completes |\n| `--timeout <minutes>` | `35` | Give up after N minutes |\n\n## Installation\n\n```bash\nnpm install -g @alexmchan/watch-github-job\n```\n\nRequires [`gh`](https://cli.github.com/) (GitHub CLI) to be installed and authenticated.\n\n### Publishing\n\n```bash\nnpm run release        # patch bump (1.0.0 → 1.0.1) + publish\nnpm run release:minor  # minor bump (1.0.0 → 1.1.0) + publish\nnpm run release:major  # major bump (1.0.0 → 2.0.0) + publish\n```\n\n### Local development\n\n```bash\ncd watch-github-job\nnpm install\nnpm run build\nnpm link\n```\n\n## Polling interval\n\nPolls every **15 seconds** throughout. Jobs rarely run longer than 45 minutes and results are usually time-sensitive, so there's no backoff.\n","readmeFilename":"README.md","_rev":"1-d6109e95beb5598601a4fa0fa5e9b1ab"}