Commit f1d6e8b
authored
fix: handle cherry-pick PR assignee failure gracefully (#1051)
## Summary
- Remove `--assignee` flag from `gh pr create` command in cherry-pick
flow
- Add post-creation assignee logic via PyGithub `add_to_assignees()`
- If PR author cannot be assigned (not a collaborator), fall back to
first root approver from OWNERS file
- Assignment failure no longer blocks cherry-pick PR creation
## Root Cause
When cherry-picking a PR, the `gh pr create --assignee {pr_author}`
command would fail entirely if the PR author wasn't a collaborator on
the target repo (e.g., fork contributors). Error: `could not assign
user: 'username' not found`
Triggered by: RedHatQE/mtv-api-tests#371
Closes #1050
## Test plan
- [x] Updated `test_cherry_pick_assigns_pr_author` to verify
post-creation assignment
- [x] Updated `test_cherry_pick_requested_by_uses_pr_owner` to verify no
`--assignee` in command
- [x] Added `test_cherry_pick_assignee_fallback_to_approver` for
fallback path
- [x] All 139 runner handler tests pass
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Release Notes
* **Bug Fixes**
* Cherry-pick pull requests now attempt to assign ownership to the
original PR author after creation, with automatic fallback to the first
root approver from the OWNERS configuration if the primary assignment
fails.
* Improved error handling and logging for pull request assignment
failures during cherry-pick operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 1c99d3e commit f1d6e8b
2 files changed
Lines changed: 68 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
855 | | - | |
856 | 855 | | |
857 | 856 | | |
858 | 857 | | |
| |||
1007 | 1006 | | |
1008 | 1007 | | |
1009 | 1008 | | |
1010 | | - | |
1011 | 1009 | | |
1012 | 1010 | | |
1013 | 1011 | | |
| |||
1083 | 1081 | | |
1084 | 1082 | | |
1085 | 1083 | | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1086 | 1115 | | |
1087 | 1116 | | |
1088 | 1117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1311 | 1311 | | |
1312 | 1312 | | |
1313 | 1313 | | |
1314 | | - | |
| 1314 | + | |
1315 | 1315 | | |
1316 | 1316 | | |
1317 | 1317 | | |
1318 | 1318 | | |
1319 | 1319 | | |
| 1320 | + | |
1320 | 1321 | | |
1321 | 1322 | | |
1322 | | - | |
1323 | | - | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1324 | 1357 | | |
1325 | 1358 | | |
1326 | 1359 | | |
| |||
1337 | 1370 | | |
1338 | 1371 | | |
1339 | 1372 | | |
1340 | | - | |
| 1373 | + | |
1341 | 1374 | | |
1342 | 1375 | | |
1343 | 1376 | | |
| |||
0 commit comments