Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PullRequest → corresponding issue #473

Closed
Chris00 opened this issue Oct 21, 2023 · 4 comments · Fixed by #476
Closed

PullRequest → corresponding issue #473

Chris00 opened this issue Oct 21, 2023 · 4 comments · Fixed by #476

Comments

@Chris00
Copy link
Contributor

Chris00 commented Oct 21, 2023

To comment on a pull request, one needs to use its issue_url field, extract its issue number and then use issues(owner, repo).create_comment(number, body) to add the comment. A function

PullRequest::issue(&self)IssueId

would be nice to have. Note that IssueId was used in order to avoid mixing it with numbers coming from other sources but then some signatures should be updated such as

pub async fn create_comment(
    &self,
    number: impl Into<IssueId>,
    body: impl AsRef<str>
) -> Result<Comment>

where u64 should implement Into<IssueId> for convenience and backward compatibility.

@XAMPPRocky
Copy link
Owner

Thank you for your issue! Seems reasonable to me, if someone wants to make a PR for it, I would be happy to review it.

@maflcko
Copy link
Contributor

maflcko commented Oct 22, 2023

I'd have to double check, but I think the issue ID is different from the issue number. One is the internal ID used by GitHub (not sure if it has meaning outside of GitHub, the other is the number you see in the URL). For example, I don't think there is an API method to create a comment based on the issue ID.

To create a comment on a pull request you can use the issues API and just pass the pull request number as the issue number. Just be aware that in octocrab the pull request number and issue number may not be their own type, but instead just are the u64 type.

@Chris00
Copy link
Contributor Author

Chris00 commented Oct 22, 2023

@maflcko You are right, the IssueId is not the same as issue number. I'll simply use u64.

@maflcko
Copy link
Contributor

maflcko commented Oct 23, 2023

Good to hear. Is there anything else to clarify or fix, or is this issue resolved?

Chris00 added a commit to Chris00/octocrab that referenced this issue Oct 24, 2023
XAMPPRocky pushed a commit that referenced this issue Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants