Is there an API for commenting on lines in a PR indexed from the top of the file?


I’m able to create comments on pull requests with my bot. I can create comments on line numbers but only offset from the start of the hunk. It would be annoying to download the PR diff, parse it, get the offset of the hunk just to subtract it from the actual line number produced by the tool. Is there a better interface?


@TomMD That’s a really good question, and I realize I don’t know the answer! I’m going to ping some of our technical support folks to see if they have any ideas—they tend to know all the corners of our APIs better than us, even though we’re the one’s building it :sweat_smile:


@TomMD I talked to our support folks and they cleared this up for me. In short there isn’t a better way, and it does make sense, though I understand that it’s frustrating.

The comments in questions are diff comments – they’re comments on a line of a diff, not a line of a file. It’s an important difference. For example, imagine a line was removed from a file. That line is visible in the diff, but not in the file. How would you identify such a line if you wanted to create a comment on it? You couldn’t because it’s not there.