Skip to content

Azure Logic App that pulls Github repo traffic data from the Github API, stores it in Azure Table Storage which can be visualized in PowerBI.

Notifications You must be signed in to change notification settings

matthansen0/logicapp-githubstats

Repository files navigation

Azure Logic App: Long-Term Github Stats

Github only tracks 14 days worth of traffic data for each repository. There are a few other projects out there that use different languages to pull the data locally, but I wanted to run this serverless in Azure which is why I created this solution to run in Azure Logic Apps.

This ARM template will deploy the following:

  • Resource Group
  • Key Vault (to store your Github Personal Access Token as a Secret)
  • Storage Account (to store your Github stats as Table Storage)
  • Logic App

The Logic App is triggered daily, and pulls the PAT from the Key Vault, queries the Github API, parses the JSON, and stores it in Table Storage.

After the data is loaded into Table Storage you can do whatever you'd like with it, though i've included a basic PowerBI template to visualize the data using PowerBI desktop.

*This solution should cost less than $0.05/month. Below is the last 12 months of running costs with the default daily trigger, you can reduce that cost to less than $0.01/month by changing it to a weekly trigger.

How to deploy:

Deployment Video Walkthrough:

For a video walkthrough, click here.

Step-by-Step Deployment:

Deploy To Azure Visualize

  • Step 3:
    • In the Azure Portal, open a PowerShell CloudShell, and run get-azaduser -UserPrincipalName [email protected] | select-object Id using the username with which you are logging into Azure (top right of the portal). Copy that Object ID,this is required for creating access policies in Key Vault and is an input parameter for deployment.

  • Step 4:
    • Enter the parameter values on the deployment screen in the Azure Portal after you clicked "Deploy to Azure", and click deploy.
  • Step 5:
    • Once complete, you will need to open the API connection for keyvault, go to "Edit API" and click the blue bar that says "Authorize". You'll be presented with a pop-up sign-in box for a one-time authentication to link the connector to KeyVault. Click save after you're done.

  • Step 6:
    • Open the Logic App, and click "Run Trigger" (the first run will have failed becuase the connector wasn't authorized so you'll see that in the run history).

  • Step 7:
    • You can verify the data by going to the storage account and viewing the table storage using Storage Explorer.
  • Step 8:

This Logic App will run every day now to collect the stats for that repo and update the storage account with anything new. You now have the data in raw form and loaded into PowerBI and can do anything you'd like with it.

Contributing:

PRs and issues welcome!

About

Azure Logic App that pulls Github repo traffic data from the Github API, stores it in Azure Table Storage which can be visualized in PowerBI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published