pull-request-fixer 0.1.0__tar.gz → 0.1.1__tar.gz

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.
Files changed (23) hide show
  1. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/.gitignore +1 -0
  2. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/PKG-INFO +249 -16
  3. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/README.md +248 -15
  4. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/_version.py +2 -2
  5. pull_request_fixer-0.1.1/src/pull_request_fixer/cli.py +1751 -0
  6. pull_request_fixer-0.1.1/src/pull_request_fixer/file_fixer.py +245 -0
  7. pull_request_fixer-0.1.1/src/pull_request_fixer/git_config.py +258 -0
  8. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/github_client.py +277 -0
  9. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/models.py +31 -0
  10. pull_request_fixer-0.1.1/src/pull_request_fixer/pr_file_fixer.py +783 -0
  11. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/pr_scanner.py +75 -0
  12. pull_request_fixer-0.1.0/src/pull_request_fixer/cli.py +0 -1059
  13. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/.pre-commit-hooks.yaml +0 -0
  14. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/LICENSE +0 -0
  15. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/LICENSES/Apache-2.0.txt +0 -0
  16. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/pyproject.toml +0 -0
  17. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/scripts/README.md +0 -0
  18. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/__init__.py +0 -0
  19. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/exceptions.py +0 -0
  20. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/graphql_queries.py +0 -0
  21. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/pr_fixer.py +0 -0
  22. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/progress_tracker.py +0 -0
  23. {pull_request_fixer-0.1.0 → pull_request_fixer-0.1.1}/src/pull_request_fixer/py.typed +0 -0
@@ -64,3 +64,4 @@ src/markdown_table_fixer/_version.py
64
64
 
65
65
  # Test output directory (created by integration tests)
66
66
  test_output/
67
+ write-good
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pull-request-fixer
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Pull request formatter and fixer with GitHub integration
5
5
  Project-URL: Homepage, https://github.com/lfit/pull-request-fixer
6
6
  Project-URL: Repository, https://github.com/lfit/pull-request-fixer.git
@@ -56,6 +56,10 @@ commit messages.
56
56
  - **✍️ Title Fixing**: Set PR titles to match the first commit's subject line
57
57
  - **📝 Body Fixing**: Set PR descriptions to match commit message bodies
58
58
  (excluding trailers)
59
+ - **📄 File Fixing**: Apply regex-based search/replace to files in PRs (clones,
60
+ modifies, amends commit, and force-pushes changes)
61
+ - **🚫 Blocked PR Filtering**: Option to process PRs that cannot merge
62
+ (failing checks, conflicts, etc.)
59
63
  - **🚀 Parallel Processing**: Process PRs concurrently for
60
64
  performance
61
65
  - **🔄 Dry Run Mode**: Preview changes before applying them
@@ -88,23 +92,46 @@ pull-request-fixer lfreleng-actions --fix-title
88
92
  # Fix both titles and bodies
89
93
  pull-request-fixer lfreleng-actions --fix-title --fix-body
90
94
 
95
+ # Show help (includes version)
96
+ pull-request-fixer --help
97
+
98
+ # Fix files in a specific PR using regex
99
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
100
+ --fix-files \
101
+ --file-pattern './action.yaml' \
102
+ --search-pattern '^\s+type:\s+\S' \
103
+ --remove-lines \
104
+ --context-start 'inputs:' \
105
+ --context-end 'runs:' \
106
+ --dry-run \
107
+ --show-diff
108
+
91
109
  # Preview changes without applying (dry run)
92
110
  pull-request-fixer lfreleng-actions --fix-title --fix-body --dry-run
93
111
  ```
94
112
 
95
113
  ## Usage
96
114
 
97
- ### Basic Command
115
+ ### Basic Commands
116
+
117
+ **Scan and fix an organization:**
98
118
 
99
119
  ```bash
100
120
  pull-request-fixer ORGANIZATION [OPTIONS]
101
121
  ```
102
122
 
103
- You can specify the organization as:
123
+ **Fix a specific PR:**
124
+
125
+ ```bash
126
+ pull-request-fixer PR_URL [OPTIONS]
127
+ ```
128
+
129
+ You can specify the target as:
104
130
 
105
131
  - Organization name: `myorg`
106
132
  - GitHub URL: `https://github.com/myorg`
107
133
  - GitHub URL with path: `https://github.com/myorg/`
134
+ - Specific PR URL: `https://github.com/owner/repo/pull/123`
108
135
 
109
136
  ### Fix Options
110
137
 
@@ -144,6 +171,94 @@ log in with special characters in passwords.
144
171
 
145
172
  The `Signed-off-by:` trailer is automatically removed.
146
173
 
174
+ #### `--fix-files`
175
+
176
+ Fixes files in pull requests using regex-based search and replace. This feature:
177
+
178
+ 1. Clones the PR branch
179
+ 2. Finds files matching `--file-pattern` (regex)
180
+ 3. Applies search/replace using `--search-pattern` and `--replacement`
181
+ 4. Amends the last commit with the changes
182
+ 5. Force-pushes the updated commit back to the PR
183
+
184
+ **Required options when using `--fix-files`:**
185
+
186
+ - `--file-pattern`: Regex to match file paths (e.g., `'./action.yaml'` or
187
+ `'.*\.yaml$'`)
188
+ - `--search-pattern`: Regex pattern to find in matched files
189
+ - Either `--replacement` (text to replace matches) or `--remove-lines` (to
190
+ delete matching lines)
191
+
192
+ **Optional context options (for line removal):**
193
+
194
+ - `--context-start`: Regex to define where the removal context begins (e.g., `'inputs:'`)
195
+ - `--context-end`: Regex to define where the removal context ends (e.g., `'runs:'`)
196
+
197
+ **Optional display options:**
198
+
199
+ - `--show-diff`: Show unified diff output for file changes
200
+
201
+ #### Update Methods (for `--fix-files` only)
202
+
203
+ The tool supports two methods for applying file fixes:
204
+
205
+ **API Method (default)** - Uses GitHub API to create new commits:
206
+
207
+ ```bash
208
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
209
+ --fix-files \
210
+ --file-pattern './action.yaml' \
211
+ --search-pattern 'pattern'
212
+ ```
213
+
214
+ - Creates new commits via GitHub API
215
+ - Shows as "Verified" by GitHub
216
+ - No Git operations required
217
+ - Faster and simpler
218
+ - Default method for ease of use
219
+
220
+ **Git Method** - Clones repo, amends commit, force-pushes:
221
+
222
+ ```bash
223
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
224
+ --fix-files \
225
+ --update-method git \
226
+ --file-pattern './action.yaml' \
227
+ --search-pattern 'pattern'
228
+ ```
229
+
230
+ - Respects your local Git signing configuration
231
+ - Amends the existing commit (preserves commit history)
232
+ - Requires Git operations (clone, amend, push)
233
+ - Use when you need to amend commits or use your own signature
234
+
235
+ **Example - Remove type definitions from GitHub Actions:**
236
+
237
+ ```bash
238
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
239
+ --fix-files \
240
+ --file-pattern './action.yaml' \
241
+ --search-pattern '^\s+type:\s+\S' \
242
+ --remove-lines \
243
+ --context-start 'inputs:' \
244
+ --context-end 'runs:' \
245
+ --dry-run \
246
+ --show-diff
247
+ ```
248
+
249
+ This will remove lines containing `type:` that appear between `inputs:` and `runs:`
250
+ sections in `action.yaml` files.
251
+
252
+ **Example - Replace text with regex:**
253
+
254
+ ```bash
255
+ pull-request-fixer https://github.com/owner/repo/pull/456 \
256
+ --fix-files \
257
+ --file-pattern '.*\.py$' \
258
+ --search-pattern 'old_function_name' \
259
+ --replacement 'new_function_name'
260
+ ```
261
+
147
262
  ### Common Usage Patterns
148
263
 
149
264
  **Fix titles:**
@@ -182,6 +297,38 @@ pull-request-fixer myorg --fix-title --workers 16
182
297
  pull-request-fixer myorg --fix-title --quiet
183
298
  ```
184
299
 
300
+ **Verbose mode for debugging:**
301
+
302
+ ```bash
303
+ pull-request-fixer myorg --fix-files --file-pattern '*.yaml' \
304
+ --search-pattern '^\s+type:\s+\S' --remove-lines \
305
+ --verbose # Shows detailed DEBUG logs including file operations
306
+ ```
307
+
308
+ **Process blocked PRs:**
309
+
310
+ <!-- write-good-disable -->
311
+ ```bash
312
+ pull-request-fixer myorg --fix-title --blocked-only
313
+ ```
314
+ <!-- write-good-enable -->
315
+
316
+ **Fix files in multiple PRs:**
317
+
318
+ <!-- write-good-disable -->
319
+ ```bash
320
+ pull-request-fixer myorg \
321
+ --fix-files \
322
+ --file-pattern './action.yaml' \
323
+ --search-pattern '^\s+type:\s+\S' \
324
+ --remove-lines \
325
+ --context-start 'inputs:' \
326
+ --context-end 'runs:' \
327
+ --blocked-only \
328
+ --dry-run
329
+ ```
330
+ <!-- write-good-enable -->
331
+
185
332
  ## PR Comments
186
333
 
187
334
  When the tool applies fixes (not in dry-run mode), it automatically adds a
@@ -207,19 +354,32 @@ comment.
207
354
 
208
355
  ## Options
209
356
 
210
- | Flag | Short | Default | Description |
211
- |------|-------|---------|-------------|
212
- | `--token` | `-t` | `$GITHUB_TOKEN` | GitHub personal access token |
213
- | `--fix-title` | | `false` | Fix PR title to match first commit subject |
214
- | `--fix-body` | | `false` | Fix PR body to match commit message body |
215
- | `--include-drafts` | | `false` | Include draft PRs in scan |
216
- | `--dry-run` | | `false` | Preview changes without applying them |
217
- | `--workers` | `-j` | `4` | Number of parallel workers (1-32) |
218
- | `--verbose` | `-v` | `false` | Enable verbose output |
219
- | `--quiet` | `-q` | `false` | Suppress output except errors |
220
- | `--log-level` | | `INFO` | Set logging level |
221
- | `--version` | | | Show version and exit |
222
- | `--help` | | | Show help message |
357
+ <!-- markdownlint-disable MD013 -->
358
+
359
+ | Flag | Short | Default | Description |
360
+ | ------------------ | ----- | --------------- | ----------------------------------------------------- |
361
+ | `--help` | `-h` | | Show help message and exit (displays version) |
362
+ | `--token` | `-t` | `$GITHUB_TOKEN` | GitHub personal access token |
363
+ | `--fix-title` | | `false` | Fix PR title to match first commit subject |
364
+ | `--fix-body` | | `false` | Fix PR body to match commit message body |
365
+ | `--fix-files` | | `false` | Fix files in PR using regex search/replace |
366
+ | `--file-pattern` | | | Regex to match file paths (required w/ `--fix-files`) |
367
+ | `--search-pattern` | | | Regex to search in files (required w/ `--fix-files`) |
368
+ | `--replacement` | | | Replacement string for matched patterns |
369
+ | `--remove-lines` | | `false` | Remove matching lines instead of replacing |
370
+ | `--context-start` | | | Regex pattern for context start (for line removal) |
371
+ | `--context-end` | | | Regex pattern for context end (for line removal) |
372
+ | `--show-diff` | | `false` | Show unified diff output for file changes |
373
+ | `--include-drafts` | | `false` | Include draft PRs in scan |
374
+ | `--blocked-only` | | `false` | Process PRs that cannot merge |
375
+ | `--dry-run` | | `false` | Preview changes without applying them |
376
+ | `--workers` | `-j` | `4` | Number of parallel workers (1-32) |
377
+ | `--verbose` | `-v` | `false` | Enable verbose output (DEBUG logs) |
378
+ | `--quiet` | `-q` | `false` | Suppress output except errors |
379
+ | `--log-level` | | `INFO` | Set logging level |
380
+ | `--version` | | | Show version and exit |
381
+
382
+ <!-- markdownlint-enable MD013 -->
223
383
 
224
384
  ## How It Works
225
385
 
@@ -343,6 +503,79 @@ Example timing for 100 repositories with 50 blocked PRs using 8 workers:
343
503
  - PR processing: ~20-30 seconds
344
504
  - **Total: ~50-90 seconds**
345
505
 
506
+ ### Example 4: Fix Files in a Blocked PR
507
+
508
+ This example removes invalid `type:` definitions from a GitHub composite action:
509
+
510
+ ```bash
511
+ pull-request-fixer https://github.com/lfreleng-actions/make-action/pull/40 \
512
+ --fix-files \
513
+ --file-pattern './action.yaml' \
514
+ --search-pattern '^\s+type:\s+\S' \
515
+ --remove-lines \
516
+ --context-start 'inputs:' \
517
+ --context-end 'runs:' \
518
+ --dry-run \
519
+ --show-diff
520
+ ```
521
+
522
+ Output:
523
+
524
+ <!-- write-good-disable -->
525
+ ```text
526
+ 🔍 Processing PR: https://github.com/lfreleng-actions/make-action/pull/40
527
+ 🔧 Will fix: files
528
+ 🏃 Dry run mode: changes will not be applied
529
+
530
+ 📝 Fixing files in PR...
531
+ ```
532
+ <!-- write-good-enable -->
533
+
534
+ ✅ Would fix 1 file
535
+ 📂 action.yaml
536
+ --- action.yaml
537
+ +++ action.yaml
538
+ @@ -10,7 +10,6 @@
539
+ repository:
540
+ description: 'Remote Git repository URL'
541
+ required: false
542
+
543
+ - type: 'string'
544
+ debug:
545
+ description: 'Enable debug mode'
546
+ required: false
547
+ - type: 'boolean'
548
+
549
+ Dry-run completed!
550
+
551
+ ```text
552
+
553
+ Without `--dry-run`, the output would show:
554
+
555
+ ```text
556
+ ✅ Updated 1 file
557
+ 🔀 action.yaml
558
+ --- action.yaml
559
+ +++ action.yaml
560
+ @@ -10,7 +10,6 @@
561
+ repository:
562
+ description: 'Remote Git repository URL'
563
+ required: false
564
+ - type: 'string'
565
+ debug:
566
+ description: 'Enable debug mode'
567
+ required: false
568
+ - type: 'boolean'
569
+ ```
570
+
571
+ This would:
572
+
573
+ 1. Clone the PR branch
574
+ 2. Remove all lines containing `type:` from the `inputs:` section of `action.yaml`
575
+ 3. Amend the last commit with the changes
576
+ 4. Force-push the updated commit
577
+ 5. Add a comment to the PR explaining the fix
578
+
346
579
  ## Troubleshooting
347
580
 
348
581
  ### No PRs Found
@@ -16,6 +16,10 @@ commit messages.
16
16
  - **✍️ Title Fixing**: Set PR titles to match the first commit's subject line
17
17
  - **📝 Body Fixing**: Set PR descriptions to match commit message bodies
18
18
  (excluding trailers)
19
+ - **📄 File Fixing**: Apply regex-based search/replace to files in PRs (clones,
20
+ modifies, amends commit, and force-pushes changes)
21
+ - **🚫 Blocked PR Filtering**: Option to process PRs that cannot merge
22
+ (failing checks, conflicts, etc.)
19
23
  - **🚀 Parallel Processing**: Process PRs concurrently for
20
24
  performance
21
25
  - **🔄 Dry Run Mode**: Preview changes before applying them
@@ -48,23 +52,46 @@ pull-request-fixer lfreleng-actions --fix-title
48
52
  # Fix both titles and bodies
49
53
  pull-request-fixer lfreleng-actions --fix-title --fix-body
50
54
 
55
+ # Show help (includes version)
56
+ pull-request-fixer --help
57
+
58
+ # Fix files in a specific PR using regex
59
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
60
+ --fix-files \
61
+ --file-pattern './action.yaml' \
62
+ --search-pattern '^\s+type:\s+\S' \
63
+ --remove-lines \
64
+ --context-start 'inputs:' \
65
+ --context-end 'runs:' \
66
+ --dry-run \
67
+ --show-diff
68
+
51
69
  # Preview changes without applying (dry run)
52
70
  pull-request-fixer lfreleng-actions --fix-title --fix-body --dry-run
53
71
  ```
54
72
 
55
73
  ## Usage
56
74
 
57
- ### Basic Command
75
+ ### Basic Commands
76
+
77
+ **Scan and fix an organization:**
58
78
 
59
79
  ```bash
60
80
  pull-request-fixer ORGANIZATION [OPTIONS]
61
81
  ```
62
82
 
63
- You can specify the organization as:
83
+ **Fix a specific PR:**
84
+
85
+ ```bash
86
+ pull-request-fixer PR_URL [OPTIONS]
87
+ ```
88
+
89
+ You can specify the target as:
64
90
 
65
91
  - Organization name: `myorg`
66
92
  - GitHub URL: `https://github.com/myorg`
67
93
  - GitHub URL with path: `https://github.com/myorg/`
94
+ - Specific PR URL: `https://github.com/owner/repo/pull/123`
68
95
 
69
96
  ### Fix Options
70
97
 
@@ -104,6 +131,94 @@ log in with special characters in passwords.
104
131
 
105
132
  The `Signed-off-by:` trailer is automatically removed.
106
133
 
134
+ #### `--fix-files`
135
+
136
+ Fixes files in pull requests using regex-based search and replace. This feature:
137
+
138
+ 1. Clones the PR branch
139
+ 2. Finds files matching `--file-pattern` (regex)
140
+ 3. Applies search/replace using `--search-pattern` and `--replacement`
141
+ 4. Amends the last commit with the changes
142
+ 5. Force-pushes the updated commit back to the PR
143
+
144
+ **Required options when using `--fix-files`:**
145
+
146
+ - `--file-pattern`: Regex to match file paths (e.g., `'./action.yaml'` or
147
+ `'.*\.yaml$'`)
148
+ - `--search-pattern`: Regex pattern to find in matched files
149
+ - Either `--replacement` (text to replace matches) or `--remove-lines` (to
150
+ delete matching lines)
151
+
152
+ **Optional context options (for line removal):**
153
+
154
+ - `--context-start`: Regex to define where the removal context begins (e.g., `'inputs:'`)
155
+ - `--context-end`: Regex to define where the removal context ends (e.g., `'runs:'`)
156
+
157
+ **Optional display options:**
158
+
159
+ - `--show-diff`: Show unified diff output for file changes
160
+
161
+ #### Update Methods (for `--fix-files` only)
162
+
163
+ The tool supports two methods for applying file fixes:
164
+
165
+ **API Method (default)** - Uses GitHub API to create new commits:
166
+
167
+ ```bash
168
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
169
+ --fix-files \
170
+ --file-pattern './action.yaml' \
171
+ --search-pattern 'pattern'
172
+ ```
173
+
174
+ - Creates new commits via GitHub API
175
+ - Shows as "Verified" by GitHub
176
+ - No Git operations required
177
+ - Faster and simpler
178
+ - Default method for ease of use
179
+
180
+ **Git Method** - Clones repo, amends commit, force-pushes:
181
+
182
+ ```bash
183
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
184
+ --fix-files \
185
+ --update-method git \
186
+ --file-pattern './action.yaml' \
187
+ --search-pattern 'pattern'
188
+ ```
189
+
190
+ - Respects your local Git signing configuration
191
+ - Amends the existing commit (preserves commit history)
192
+ - Requires Git operations (clone, amend, push)
193
+ - Use when you need to amend commits or use your own signature
194
+
195
+ **Example - Remove type definitions from GitHub Actions:**
196
+
197
+ ```bash
198
+ pull-request-fixer https://github.com/owner/repo/pull/123 \
199
+ --fix-files \
200
+ --file-pattern './action.yaml' \
201
+ --search-pattern '^\s+type:\s+\S' \
202
+ --remove-lines \
203
+ --context-start 'inputs:' \
204
+ --context-end 'runs:' \
205
+ --dry-run \
206
+ --show-diff
207
+ ```
208
+
209
+ This will remove lines containing `type:` that appear between `inputs:` and `runs:`
210
+ sections in `action.yaml` files.
211
+
212
+ **Example - Replace text with regex:**
213
+
214
+ ```bash
215
+ pull-request-fixer https://github.com/owner/repo/pull/456 \
216
+ --fix-files \
217
+ --file-pattern '.*\.py$' \
218
+ --search-pattern 'old_function_name' \
219
+ --replacement 'new_function_name'
220
+ ```
221
+
107
222
  ### Common Usage Patterns
108
223
 
109
224
  **Fix titles:**
@@ -142,6 +257,38 @@ pull-request-fixer myorg --fix-title --workers 16
142
257
  pull-request-fixer myorg --fix-title --quiet
143
258
  ```
144
259
 
260
+ **Verbose mode for debugging:**
261
+
262
+ ```bash
263
+ pull-request-fixer myorg --fix-files --file-pattern '*.yaml' \
264
+ --search-pattern '^\s+type:\s+\S' --remove-lines \
265
+ --verbose # Shows detailed DEBUG logs including file operations
266
+ ```
267
+
268
+ **Process blocked PRs:**
269
+
270
+ <!-- write-good-disable -->
271
+ ```bash
272
+ pull-request-fixer myorg --fix-title --blocked-only
273
+ ```
274
+ <!-- write-good-enable -->
275
+
276
+ **Fix files in multiple PRs:**
277
+
278
+ <!-- write-good-disable -->
279
+ ```bash
280
+ pull-request-fixer myorg \
281
+ --fix-files \
282
+ --file-pattern './action.yaml' \
283
+ --search-pattern '^\s+type:\s+\S' \
284
+ --remove-lines \
285
+ --context-start 'inputs:' \
286
+ --context-end 'runs:' \
287
+ --blocked-only \
288
+ --dry-run
289
+ ```
290
+ <!-- write-good-enable -->
291
+
145
292
  ## PR Comments
146
293
 
147
294
  When the tool applies fixes (not in dry-run mode), it automatically adds a
@@ -167,19 +314,32 @@ comment.
167
314
 
168
315
  ## Options
169
316
 
170
- | Flag | Short | Default | Description |
171
- |------|-------|---------|-------------|
172
- | `--token` | `-t` | `$GITHUB_TOKEN` | GitHub personal access token |
173
- | `--fix-title` | | `false` | Fix PR title to match first commit subject |
174
- | `--fix-body` | | `false` | Fix PR body to match commit message body |
175
- | `--include-drafts` | | `false` | Include draft PRs in scan |
176
- | `--dry-run` | | `false` | Preview changes without applying them |
177
- | `--workers` | `-j` | `4` | Number of parallel workers (1-32) |
178
- | `--verbose` | `-v` | `false` | Enable verbose output |
179
- | `--quiet` | `-q` | `false` | Suppress output except errors |
180
- | `--log-level` | | `INFO` | Set logging level |
181
- | `--version` | | | Show version and exit |
182
- | `--help` | | | Show help message |
317
+ <!-- markdownlint-disable MD013 -->
318
+
319
+ | Flag | Short | Default | Description |
320
+ | ------------------ | ----- | --------------- | ----------------------------------------------------- |
321
+ | `--help` | `-h` | | Show help message and exit (displays version) |
322
+ | `--token` | `-t` | `$GITHUB_TOKEN` | GitHub personal access token |
323
+ | `--fix-title` | | `false` | Fix PR title to match first commit subject |
324
+ | `--fix-body` | | `false` | Fix PR body to match commit message body |
325
+ | `--fix-files` | | `false` | Fix files in PR using regex search/replace |
326
+ | `--file-pattern` | | | Regex to match file paths (required w/ `--fix-files`) |
327
+ | `--search-pattern` | | | Regex to search in files (required w/ `--fix-files`) |
328
+ | `--replacement` | | | Replacement string for matched patterns |
329
+ | `--remove-lines` | | `false` | Remove matching lines instead of replacing |
330
+ | `--context-start` | | | Regex pattern for context start (for line removal) |
331
+ | `--context-end` | | | Regex pattern for context end (for line removal) |
332
+ | `--show-diff` | | `false` | Show unified diff output for file changes |
333
+ | `--include-drafts` | | `false` | Include draft PRs in scan |
334
+ | `--blocked-only` | | `false` | Process PRs that cannot merge |
335
+ | `--dry-run` | | `false` | Preview changes without applying them |
336
+ | `--workers` | `-j` | `4` | Number of parallel workers (1-32) |
337
+ | `--verbose` | `-v` | `false` | Enable verbose output (DEBUG logs) |
338
+ | `--quiet` | `-q` | `false` | Suppress output except errors |
339
+ | `--log-level` | | `INFO` | Set logging level |
340
+ | `--version` | | | Show version and exit |
341
+
342
+ <!-- markdownlint-enable MD013 -->
183
343
 
184
344
  ## How It Works
185
345
 
@@ -303,6 +463,79 @@ Example timing for 100 repositories with 50 blocked PRs using 8 workers:
303
463
  - PR processing: ~20-30 seconds
304
464
  - **Total: ~50-90 seconds**
305
465
 
466
+ ### Example 4: Fix Files in a Blocked PR
467
+
468
+ This example removes invalid `type:` definitions from a GitHub composite action:
469
+
470
+ ```bash
471
+ pull-request-fixer https://github.com/lfreleng-actions/make-action/pull/40 \
472
+ --fix-files \
473
+ --file-pattern './action.yaml' \
474
+ --search-pattern '^\s+type:\s+\S' \
475
+ --remove-lines \
476
+ --context-start 'inputs:' \
477
+ --context-end 'runs:' \
478
+ --dry-run \
479
+ --show-diff
480
+ ```
481
+
482
+ Output:
483
+
484
+ <!-- write-good-disable -->
485
+ ```text
486
+ 🔍 Processing PR: https://github.com/lfreleng-actions/make-action/pull/40
487
+ 🔧 Will fix: files
488
+ 🏃 Dry run mode: changes will not be applied
489
+
490
+ 📝 Fixing files in PR...
491
+ ```
492
+ <!-- write-good-enable -->
493
+
494
+ ✅ Would fix 1 file
495
+ 📂 action.yaml
496
+ --- action.yaml
497
+ +++ action.yaml
498
+ @@ -10,7 +10,6 @@
499
+ repository:
500
+ description: 'Remote Git repository URL'
501
+ required: false
502
+
503
+ - type: 'string'
504
+ debug:
505
+ description: 'Enable debug mode'
506
+ required: false
507
+ - type: 'boolean'
508
+
509
+ Dry-run completed!
510
+
511
+ ```text
512
+
513
+ Without `--dry-run`, the output would show:
514
+
515
+ ```text
516
+ ✅ Updated 1 file
517
+ 🔀 action.yaml
518
+ --- action.yaml
519
+ +++ action.yaml
520
+ @@ -10,7 +10,6 @@
521
+ repository:
522
+ description: 'Remote Git repository URL'
523
+ required: false
524
+ - type: 'string'
525
+ debug:
526
+ description: 'Enable debug mode'
527
+ required: false
528
+ - type: 'boolean'
529
+ ```
530
+
531
+ This would:
532
+
533
+ 1. Clone the PR branch
534
+ 2. Remove all lines containing `type:` from the `inputs:` section of `action.yaml`
535
+ 3. Amend the last commit with the changes
536
+ 4. Force-push the updated commit
537
+ 5. Add a comment to the PR explaining the fix
538
+
306
539
  ## Troubleshooting
307
540
 
308
541
  ### No PRs Found
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.1.0'
32
- __version_tuple__ = version_tuple = (0, 1, 0)
31
+ __version__ = version = '0.1.1'
32
+ __version_tuple__ = version_tuple = (0, 1, 1)
33
33
 
34
34
  __commit_id__ = commit_id = None