Github - How to get started with Github in Automations
This article gives an overview of the available blocks in the Github connector in Qlik Application Automation. It will also go over some basic examples of retrieving file/blob contents from your repos as well as other functionalities within a Github account.
As with most connectors provided for automations the authentication for this connector is based on the oAuth2 Protocol, so when connecting to it you provide the user name and password of the account directly to the Github platform to request access so it is done in the most secure manner there is.
Let's now go over a few basic examples of how to use the Github connector: 1. How to list owned repositories and check their contents from your Github account.
Create an automation;
From the left menu, select the Github connector;
drag and drop the "List my repositories" block
drag and drop the "List repositories contents" block inside the loop created by the first block:
Now the "list my repositories" block offers a couple of filtering options depending what result you want (all repos or just the private or public ones and if you want the result to come in sorted by some rule) but they are mostly optional. Not filling them in will return by default all repositories.
As for the "List repository contents" block you will need to fill in the username you use for your github account as well as the repository name which can be filled in with the results gotten from the first block. You can leave the path parameter empty to get the contents from the root folder or you can specify a path and the contents of that path will be returned.
As stated, if you expect to retrieve only one record, the use of "get repository content" block is more better suited. Also you might want to switch this "List repository contents" block On Error status to either warning or ignore since Github API platform returns a 404 error if one of the queried repositories is empty.
Now if you are planning to use the "Get repository content" block another warning should be mentioned and that this block only works for files or blobs up to a maximum of 1 MB in size, as per Githubs platform limitations. The response of this block should look like:
As you can see we have a couple of information stubs of that file, but most importantly from here is the SHA property, which is needed if you are planning to later on use the "Create or update file contents" block, required input parameter for the update of a file/blob.
Now if you're planning on updating files that are bigger than 1MB and you require the SHA of that file, we suggest using the list repository contents block and search for the required file and SHA in that result.
As for other functionalities of the Github connector we support also getting and listing commits or issues present in a repository, listing of users and many other requests but, if you are in need of a request that isn't present, we also offer the functionality to create your own requests to the Github API by making use of the RAW API blocks. These API blocks and their uses are explained in a separate article.
You can find attached to this article a simple JSON example which you can upload to your workspace, if you want to see a quick example of how to use version control to back up your QCS apps I suggest visiting the related article.
The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.