File tree 2 files changed +131
-0
lines changed
2 files changed +131
-0
lines changed Original file line number Diff line number Diff line change
1
+ AAD
2
+ ACS
3
+ AKS
4
+ ARM
5
+ Advisor
6
+ Analysis Services
7
+ API Management
8
+ Application Insights
9
+ App Services
10
+ Authorization
11
+ Automation
12
+ Azure Stack
13
+ Azure Cloud Shell
14
+ Batch
15
+ BatchAI
16
+ Billing
17
+ CDN
18
+ Cognitive Services
19
+ Commerce
20
+ Compute
21
+ Compute - Extensions
22
+ Compute - Images
23
+ Compute - Managed Disks
24
+ Compute - VM
25
+ Compute - VMSS
26
+ Consumption
27
+ Container Instance
28
+ Container Registry
29
+ CosmosDB
30
+ Customer Insights
31
+ Data Catalog
32
+ Data Factory
33
+ Data Lake
34
+ Data Lake Analytics
35
+ Data Lake Store
36
+ Data Migration
37
+ Devtestlab
38
+ Event Grid
39
+ Event Hub
40
+ Graph
41
+ HDInsight
42
+ Import Export
43
+ Intune
44
+ Insights
45
+ IotHub
46
+ KeyVault
47
+ Logic App
48
+ Machine Learning
49
+ Machine Learning Compute
50
+ Machine Learning Experimentation
51
+ Marketplace Ordering
52
+ Media Services
53
+ Migrate
54
+ Mobile Engagement
55
+ Monitor
56
+ MySQL
57
+ Network
58
+ Network - Application Gateway
59
+ Network - Express Routes
60
+ Network - Gateways
61
+ Network - Load Balancer
62
+ Network - Watcher
63
+ Network - DNS
64
+ Network - Traffic Manager
65
+ Notification Hubs
66
+ Operational Insights
67
+ Operations Management
68
+ Policy Insights
69
+ PostgreSQL
70
+ PowerBI
71
+ Recovery Services
72
+ Recovery Services Backup
73
+ Recovery Services Site-Recovery
74
+ Redis Cache
75
+ Relay
76
+ Reservations
77
+ Resource Authorization
78
+ Resource Manager
79
+ Resource Health
80
+ Search
81
+ Security
82
+ Scheduler
83
+ Server Management
84
+ Service Bus
85
+ Service Fabric
86
+ Service Map
87
+ SQL
88
+ Storage
89
+ Storsimple
90
+ Stream Analytics
91
+ TimeseriesInsights
92
+ Visual Studio
Original file line number Diff line number Diff line change
1
+ import os
2
+ import sys
3
+
4
+ from github import Github , GithubException
5
+
6
+ LABEL_COLOUR = "e99695"
7
+
8
+
9
+ def get_repo (repo_name ):
10
+ con = Github (os .environ ["GH_TOKEN" ])
11
+ repo = con .get_repo (repo_name )
12
+ repo .name # Force checking if repo exists, otherwise "get_repo" does nothing
13
+ return repo
14
+
15
+
16
+ def create_label (repo , label ):
17
+ print (f"Adding label { label } " )
18
+ try :
19
+ repo .create_label (label , LABEL_COLOUR )
20
+ print (f"-> Created label { label } " )
21
+ except GithubException as err :
22
+ err_code = err .data ['errors' ][0 ].get ('code' , '' )
23
+ if err .status == 422 and err_code == "already_exists" :
24
+ print (f"-> Label { label } already exists" )
25
+ return
26
+ raise
27
+
28
+ def do (repo_name , label_filepath ):
29
+ print (f"Getting repo { repo_name } " )
30
+ repo = get_repo (repo_name )
31
+
32
+ print ("Adding labels to repo" )
33
+ with open (label_filepath , "r" ) as fd :
34
+ for label in fd .read ().splitlines ():
35
+ create_label (repo , label )
36
+
37
+
38
+ if __name__ == "__main__" :
39
+ do (sys .argv [1 ], sys .argv [2 ])
You can’t perform that action at this time.
0 commit comments