This blogpost will show you how to embed files from your GitHub repository.
Let's say you have the file foo.sh
and want to embed it into Confluence.
You will have to click the raw button and copy the raw-url. In our case:https://raw.githubusercontent.com/clouless/test2/main/foo.sh
Now install the Advanced Codeblocks for Confluence App. Then edit your page and insert the Advanced Codeblocks Multi Remote Macro.
As URL paste the RAW-URL of the file. If it is a private repository you will need to use your GitHub Username and a GitHub Personal Access Token as password.
Now click save and edit the macro body so that we will have at least one section called [demo]
(see userguide for more info).
Now click save and your file should render in the Confluence page.
You can embed files from a private and a public GitHub repository. You can use a GitHub username and a GitHub Personal Access Token as password for private repositories. For private files the RAW url has a token attached in form of https://raw.githubusercontent.com/.../filename?token=XYZ
- which you can also directly use as URL and leave username+password blank. Do this in accordance with your companies security requirements.