According to the following documentation, it is possible to directly create a new issue from code. Ref: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/creating-an-issue#creating-an-issue-from-code
This is not working within my organization. So, let's try with my private user account...
- To open an issue about code in a file, navigate to the file.
- Choose whether to select a single line or a range.
- To select a single line of code, click the line number to highlight the line.
- To select a range of code, click the number of the first line in the range to highlight the line of code. Then, hover over the last line of the code range, press Shift, and click the line number to highlight the range.
- To the left of the code range, click 3 dots. In the dropdown menu, click Reference in new issue.
- Add title and description
- Submit new issue