Commit 7ddbf35
authored
fix: guard nil invitation from AddCollaborator for org members (#3371)
When the invitee of `github_repository_collaborators` is an organization
member who is not yet a direct collaborator, GitHub's REST API returns
`204 No Content` from `PUT /repos/{owner}/{repo}/collaborators/{username}`
(the user is promoted to direct collaborator immediately, no invitation is
issued). The Go client surfaces this as `inv == nil, err == nil`.
Since #3233 the create/update path in `updateUserCollaboratorsAndInvites`
unconditionally dereferences `inv.ID`, causing a nil pointer panic for
any configuration that adds an org member as a direct collaborator for
the first time.
Guard the invitation-tracking branch on `inv != nil`. On the 204 path
there is no invitation to record; the user is a direct collaborator
already and will be picked up by the next `listUserCollaborators` call.
Signed-off-by: bofus10 <33520078+bofus10@users.noreply.github.com>1 parent 18178b1 commit 7ddbf35
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
694 | | - | |
695 | | - | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
696 | 701 | | |
697 | 702 | | |
698 | 703 | | |
| |||
0 commit comments