how to render an image from the code repo in github pull request body

24 Views Asked by At

We have a template to render the body of the Pull Request in the code repo.

we would need to render an image from the code repo as part of the Pull Request body markdown.

![instruction screenshot](path-to-image)

it is not obvious how to define the path to the image.

there is a doc about show images in github README file however, it doesn't work for Pull Request body markdown.

1

There are 1 best solutions below

0
Hui Zheng On

The solution is to use github URL link to the image.

https://github.com/account/repo-name/blob/branch-name/path/image.png?raw=true

IMPORTANT: remember to use the suffix ?raw=true so that it links to the raw image file.

NOTE: if you want to use the specific version of the image, use permanent link.

https://github.com/github/codeql/blob/b212af08a6cffbb434f3c8a2795a579e092792fd/img.png?raw=true