Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Note

Support for Atlassian Server Products is ending in February 2024. Consider migrating to Github Macros for Confluence’s Data Center version.

Or, are you planning to migrate to Cloud? Make sure you do not lose your data/configurations in the process. Check out the Migration guide for information on how to migrate the app’s data to Cloud. Contact our support team if you have any questions.

Macro to include code snippets, files, issues and more from Github into Confluence

...

Table of Contents
maxLevel3
minLevel3

Note

Once a Github token is configured, all confluence users will have access to it when using the macros. This means that contents of private repositories will be accessible to all confluence Confluence users.

 

If enabled, macro will use tokens with Github API to render private images and links in Markdown from your private Github repositories. Note, that Github has a limit for API calls, so if your page with Github Macro has thousands of views, you may exceed the hourly API call limit of your token.

Register new personal access token

Info

You 'll will need a personal access token from Github to configure the plugin for server. Create a personal access token here.

Once you 've have obtained a personal access token click the Add new token button on the plugin configuration page. 

Image Modified

You'll be presented with a A configuration dialog appears. Enter your username and personal access token here. If you 're are using Github Enterprise, you can also add the optional URL for your own Github server. Once you 're done click the Add buttonare done, click Add.


Limit the number of lines (Optional)

If you want to display only certain lines of code, specify the limit of the code lines to be displayed. You Leave this parameter blank to display complete code lines.  Or, you can specify range or number of maximum lines to be displayed. For example: 5, 2-25.

Leave this parameter blank to display complete code lines. 

Info
  • This parameter is applicable only for GitHub file macro. 
  • The global configuration parameter Limit the number of Lines is the default value for the macro parameter Lines of code of a new macro.
  • You can specify the lines Lines of code macro parameter within each macro, and this will take takes precedence over the Limit the number of Lines specified in the global configuration.
  • You can hide the line numbers displayed in code block. To hide go to the line numbers, go to the GitHub file macro and select the Hide line numbers of code block checkbox.

Available Macros

  • Github Pull Request List
  • GIthub Issue List
  • Github Markdown File
  • Github File Content

Here is an example of the Github Pull Request List macro filled out. We used a public repository so you can copy the values if you want to try it out for yourselves.

Using the Macro

Image Removed

To use the macro, select your token from the dropdown, and add the username or organization name for the repository you want to pull information from. 

...

You are now ready to get started with the macro!

Refer to the Macros page to learn more about the macros.