You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Github only tracks 14 days worth of traffic data for each repository. There are a few other projects out there that use C#, Python and other langauges to pull the data locally but I wanted to run this serverless in Azure which is why I created this solution.
3
+
Github only tracks 14 days worth of traffic data for each repository. There are a few other projects out there that use different langauges 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](https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-overview).
4
4
5
5
This ARM template will deploy the following:
6
6
7
7
- Resource Group
8
-
-KeyVault (to store your Github Personal Access Tolken as a Secret)
8
+
-Key Vault (to store your Github Personal Access Token as a Secret)
9
9
- Storage Account (to store your Github stats as Table Storage)
10
10
- Logic App
11
11
@@ -15,24 +15,54 @@ After the data is loaded into Table Storage you can do whatever you'd like with
15
15
16
16
This solution should cost less than $0.05/month (I'll update this statistic once I've run it longer, as of Dec 31, 2020 I've had it running for 4 days and it's cost me $0.01).
17
17
18
+
### Contributing:
19
+
20
+
PRs and issues welcome!
21
+
18
22
19
23
## How to deploy:
20
24
21
-
- Step 1:
22
-
- You will need a Github Personal Access Tolken, you can view the Github docs on that here: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token
23
-
- Step 2:
24
-
- Click "Deploy to Azure" below
25
-
- Step 3:
26
-
- Open CloudShell, and run ```get-azaduser -UserPrincipalName [email protected] | select-object Id``` and copy that Object ID
27
-
- Step 4:
28
-
- Enter the parameter values on the deployment screen, and click deploy.
29
-
- Step 5:
25
+
*I will be recording and posting a deployment video soon, in the mean time you can follow the steps below.*
26
+
27
+
-**Step 1**:
28
+
- You will need a Github Personal Access Token, you can view the Github docs on that here: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token
29
+
-**Step 2**:
30
+
- Click [Deploy to Azure](#deploy), in the Deploy section of this page.
31
+
-**Step 3**:
32
+
- 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.
33
+
34
+
<imgsrc="images/cloudshell.png"width="75%">
35
+
36
+
<imgsrc="images/objectID.png"width="75%">
37
+
38
+
39
+
-**Step 4**:
40
+
- Enter the parameter values on the deployment screen in the Azure Portal after you clicked "Deploy to Azure", and click deploy.
41
+
-**Step 5**:
30
42
- 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.
31
-
- Step 6:
43
+
44
+
<imgsrc="images/authorizeKV.png"width="75%">
45
+
46
+
<imgsrc="images/connectedKV.png"width="75%">
47
+
48
+
-**Step 6**:
32
49
- 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).
33
-
- Step 7:
50
+
51
+
<imgsrc="images/logicappRun.png"width="75%">
52
+
53
+
-**Step 7**:
34
54
- You can verify the data by going to the storage account and viewing the table storage using Storage Explorer.
35
-
- Step 8:
36
-
- Open the PowerBI template, enter your storage account name and account key (account keys tab on the storage account in the portal) and your data should show up on the dashboard.
55
+
-**Step 8**:
56
+
- Open the PowerBI template using [PowerBI Desktop](https://powerbi.microsoft.com/en-us/downloads/), enter your storage account name and account key (account keys tab on the storage account in the portal) and your data should show up on the dashboard.
57
+
58
+
<imgsrc="images/accessKey.png"width="75%">
59
+
60
+
<imgsrc="images/powerBI.png"width="75%">
61
+
62
+
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.
63
+
## Deploy:
64
+
65
+
[//]: #(The short URLs below are to show impact of this solution by tracking number of deployments. You can use the direct link if you wish - https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FMattHansen0%2Flogicapp-githubstats%2Fmain%2Fazuredeploy.json)
66
+
37
67
38
-
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FMattHansen0%2Flogicapp-githubstats%2Fmain%2Fazuredeploy.json)[](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FMattHansen0%2Flogicapp-githubstats%2Fmain%2Fazuredeploy.json)
68
+
[](https://urls.hansencloud.com/deploy-githubstats-logicapp)[](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FMattHansen0%2Flogicapp-githubstats%2Fmain%2Fazuredeploy.json)
0 commit comments