prwatcher 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,14 +41,14 @@ On first run you'll be prompted for a GitHub personal access token. Here's what
41
41
  - `Metadata` → Read-only (required)
42
42
  - `Pull requests` → Read-only
43
43
 
44
- #### Watching + Auto-merge (`--auto-merge`)
44
+ #### Watching + Auto-merge (`--auto-merge`) or Auto-rebase (`--auto-rebase`)
45
45
 
46
46
  **Classic token** — check `repo` scope
47
47
 
48
48
  **Fine-grained token** — enable:
49
49
  - `Metadata` → Read-only (required)
50
50
  - `Pull requests` → Read and write
51
- - `Contents` → Read and write ← required for merging
51
+ - `Contents` → Read and write ← required for merging and rebasing
52
52
 
53
53
  > Your token is saved to `~/.watch-pr` on your machine with owner-only permissions (0600). It is never sent anywhere except the GitHub API.
54
54
 
@@ -71,6 +71,7 @@ prwatcher <pr-url> [options]
71
71
  Options:
72
72
  --interval <minutes> Polling interval in minutes (default: 1)
73
73
  --auto-merge Automatically merge PR once all required checks pass
74
+ --auto-rebase Automatically rebase PR branch when behind (no conflicts only)
74
75
  --reset-config Re-enter GitHub token and Slack webhook URL
75
76
  -V, --version Output version number
76
77
  -h, --help Display help
@@ -85,6 +86,12 @@ prwatcher https://github.com/org/repo/pull/42
85
86
  # Watch and auto-merge when ready
86
87
  prwatcher https://github.com/org/repo/pull/42 --auto-merge
87
88
 
89
+ # Auto-rebase when behind base branch (no conflicts only)
90
+ prwatcher https://github.com/org/repo/pull/42 --auto-rebase
91
+
92
+ # Auto-rebase + auto-merge (full automation)
93
+ prwatcher https://github.com/org/repo/pull/42 --auto-rebase --auto-merge
94
+
88
95
  # Poll every 30 seconds
89
96
  prwatcher https://github.com/org/repo/pull/42 --interval 0.5
90
97
 
@@ -107,7 +114,9 @@ You'll get Slack messages when:
107
114
  | PR is auto-merged | 🎉 PR was auto-merged! |
108
115
  | PR is merged | 🎉 PR was merged! |
109
116
  | PR is closed | ❌ PR was closed without merging |
117
+ | Waiting for review approval | 👀 PR waiting for review (CI passed) |
110
118
  | Auto-merge failed | ⚠️ Auto-merge failed (with reason) |
119
+ | PR auto-rebased | 🔄 PR branch auto-rebased from base branch |
111
120
 
112
121
  Notifications only fire on **state changes** — no spam.
113
122
 
package/bin/watch-pr.js CHANGED
@@ -6,7 +6,7 @@ const { run } = require('../src/cli');
6
6
  program
7
7
  .name('prwatcher')
8
8
  .description('Watch a GitHub PR and get Slack notifications on state changes')
9
- .version('2.2.0')
9
+ .version('2.3.0')
10
10
  .argument('<pr-url>', 'GitHub PR URL (e.g., https://github.com/owner/repo/pull/123)')
11
11
  .option('--interval <minutes>', 'polling interval in minutes', '1')
12
12
  .option('--auto-merge', 'automatically merge PR once all required checks pass')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prwatcher",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "CLI tool that watches GitHub PRs and sends Slack notifications when CI passes, fails, or PR is ready to merge",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -187,7 +187,16 @@ async function run(prUrl, options = {}) {
187
187
  return;
188
188
  }
189
189
 
190
- // Blocked CI passed but review approval required
190
+ // Check if CI is still running show pending status regardless of mergeable state
191
+ const pending = state.checks ? state.checks.pendingRequired.length : 0;
192
+ const total = state.checks ? state.checks.requiredTotal : 0;
193
+
194
+ if (pending > 0) {
195
+ console.log(` ⏳ ${timestamp} — CI running (${total - pending}/${total} required checks done)`);
196
+ return;
197
+ }
198
+
199
+ // Blocked — all CI passed but review approval or other requirement missing
191
200
  if (state.mergeableState === 'blocked') {
192
201
  if (lastState !== 'needs_review') {
193
202
  console.log(` 👀 ${timestamp} — Waiting for review approval`);
@@ -199,10 +208,8 @@ async function run(prUrl, options = {}) {
199
208
  return;
200
209
  }
201
210
 
202
- // Pending / other state
203
- const pending = state.checks ? state.checks.pendingRequired.length : 0;
204
- const total = state.checks ? state.checks.requiredTotal : 0;
205
- console.log(` ⏳ ${timestamp} — CI running (${total - pending}/${total} required checks done, mergeable: ${state.mergeableState || 'unknown'})`);
211
+ // Other unknown state
212
+ console.log(` ⏳ ${timestamp} Waiting (mergeable: ${state.mergeableState || 'unknown'})`);
206
213
 
207
214
  } catch (error) {
208
215
  const timestamp = new Date().toLocaleTimeString();