Configuring Github Macros for Confluence (Cloud)
Macro to include code snippets, files, issues, and more from Github into Confluence
- Include and render files from Github into Confluence.
- Include issue lists from Github into Confluence.
- Include pull request lists from Github into Confluence.
- Support for both private and public repositories.
Go to the app configuration page to add a Github token. To do so, you can perform either of the following actions:
- Navigate to Settings > Manage apps > Github Macros for Confluence. Then, click Configure to open the app configuration page.
- Select Github Macro for Confluence Configuration under Atlassian Marketplace in the panel on the left.
Enter a name for the token and click Create new Link. An intermediate page is then displayed.
Check the address of the Atlassian cloud instance and token name. After verifying the details, press Start workflow. You are then redirected to the Github authorization page.
Click Authorize and the token page is now displayed. After the authentication is completed, you can enter the number or a number range of the code lines to be displayed in the Github File macro.
About the Limit the number of lines parameter:
If you want to display only certain lines of code, specify the limit of the code lines to be displayed and click Submit. You can specify range or number of maximum lines to be displayed. For example: 5, 2-25.
- This parameter in the global configuration page is applicable only for the Github File macro.
- You can hide the line numbers displayed in code block. To hide go to GitHub file macro and select the Hide line numbers of code block checkbox.
The Limit the number of lines parameter set in the macro editor has higher precedence than the global configuration parameter. Thus, the parameter behaves as follows:
Is the global parameter set? Is the macro parameter set? Behaviour Y Y The code lines limit is taken from the macro parameter and the specified number or number range of lines are displayed regardless of the value set in the global parameter. Y N The code lines limit is taken from the global configuration parameter and the macro displays the specified number or number range of lines.
You are now ready to get started with the macro!
- Github Pull Request List
- Github Issue List
- Github Markdown File
- Github File Content
Using the macro
Here is an example of the Github Issue List macro filled out. The example contains details linking to a public repository so you can copy the values to try it out.
To use the macro, you must select your token from the dropdown. Enter the user name or the organization name, and the name of the repository to retrieve information from.
Pull requests and issues have a query field. You can use Github's Query language to select pull requests or issues you want to display.