Octokit's PullRequest class needs a ToUpdate() to create a pre-populated IssueUpdate #2629
JimSuplizio
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are actually a couple of items in here relating to IssueUpdate creation.
The Issue documentation for update states "by default, no labels are set in an IssueUpdate - this is to indicate to the server that no change is necessary when doing the update." which isn't completely correct. Octokit/Models/Response/Issue.cs's ToUpdate function does, in fact, populate milestoneId, assignees, state, title and, lastly, any labels that are already on the issue. Any changes to the IssueUpdate instance prior to calling GitHubClient.Issue.Update will cause them to be updated in the Issue. If these default populations, from ToUpdate, aren't there, like if you just did a new IssueUpdate, then everything not setup with defaults, will be set to whatever is in the IssueUpdate when the GitHubClient.Issue.Update is called. The milestoneId, assignees, state, title and lables in the IssueUpdate replace what's on the Issue. Creating an empty IssueUpdate and adding label "foo", then updating will replace any existing labels on the issue with "foo" since that was the only label in the update. It needs the prefills.
PullRequests, are also updated using IssueUpdate but there's no ToUpdate on PullRequest, meaning that the user needs to prefill the IssueUpdate themselves or risk losing/resetting existing milestoneId, assignees, state, title and labels. Since PullRequests are updated like Issues there should be a ToUpdate on PullRequest that behaves like the ToUpdate on Issues.
//CC @nickfloyd
Beta Was this translation helpful? Give feedback.
All reactions