-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
AAD | ||
ACS | ||
AKS | ||
ARM | ||
Advisor | ||
Analysis Services | ||
API Management | ||
Application Insights | ||
App Services | ||
Authorization | ||
Automation | ||
Azure Stack | ||
Azure Cloud Shell | ||
Batch | ||
BatchAI | ||
Billing | ||
CDN | ||
Cognitive Services | ||
Commerce | ||
Compute | ||
Compute - Extensions | ||
Compute - Images | ||
Compute - Managed Disks | ||
Compute - VM | ||
Compute - VMSS | ||
Consumption | ||
Container Instance | ||
Container Registry | ||
CosmosDB | ||
Customer Insights | ||
Data Catalog | ||
Data Factory | ||
Data Lake | ||
Data Lake Analytics | ||
Data Lake Store | ||
Data Migration | ||
Devtestlab | ||
Event Grid | ||
Event Hub | ||
Graph | ||
HDInsight | ||
Import Export | ||
Intune | ||
Insights | ||
IotHub | ||
KeyVault | ||
Logic App | ||
Machine Learning | ||
Machine Learning Compute | ||
Machine Learning Experimentation | ||
Marketplace Ordering | ||
Media Services | ||
Migrate | ||
Mobile Engagement | ||
Monitor | ||
MySQL | ||
Network | ||
Network - Application Gateway | ||
Network - Express Routes | ||
Network - Gateways | ||
Network - Load Balancer | ||
Network - Watcher | ||
Network - DNS | ||
Network - Traffic Manager | ||
Notification Hubs | ||
Operational Insights | ||
Operations Management | ||
Policy Insights | ||
PostgreSQL | ||
PowerBI | ||
Recovery Services | ||
Recovery Services Backup | ||
Recovery Services Site-Recovery | ||
Redis Cache | ||
Relay | ||
Reservations | ||
Resource Authorization | ||
Resource Manager | ||
Resource Health | ||
Search | ||
Security | ||
Scheduler | ||
Server Management | ||
Service Bus | ||
Service Fabric | ||
Service Map | ||
SQL | ||
Storage | ||
Storsimple | ||
Stream Analytics | ||
TimeseriesInsights | ||
Visual Studio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import sys | ||
|
||
from github import Github, GithubException | ||
|
||
LABEL_COLOUR = "e99695" | ||
|
||
|
||
def get_repo(repo_name): | ||
con = Github(os.environ["GH_TOKEN"]) | ||
repo = con.get_repo(repo_name) | ||
repo.name # Force checking if repo exists, otherwise "get_repo" does nothing | ||
return repo | ||
|
||
|
||
def create_label(repo, label): | ||
print(f"Adding label {label}") | ||
try: | ||
repo.create_label(label, LABEL_COLOUR) | ||
print(f"-> Created label {label}") | ||
except GithubException as err: | ||
err_code = err.data['errors'][0].get('code', '') | ||
if err.status == 422 and err_code == "already_exists": | ||
print(f"-> Label {label} already exists") | ||
return | ||
raise | ||
|
||
def do(repo_name, label_filepath): | ||
print(f"Getting repo {repo_name}") | ||
repo = get_repo(repo_name) | ||
|
||
print("Adding labels to repo") | ||
with open(label_filepath, "r") as fd: | ||
for label in fd.read().splitlines(): | ||
create_label(repo, label) | ||
|
||
|
||
if __name__ == "__main__": | ||
do(sys.argv[1], sys.argv[2]) |