Skip to content

Commit e601526

Browse files
authored
Update get-metrics.py
1 parent 83cc193 commit e601526

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/get-metrics.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010
FOUNDATIONS_ID = os.environ['FOUNDATIONS_ID']
1111
COOKBOOKS_ID = os.environ['COOKBOOKS_ID']
1212

13-
PRIVATE_KEY = os.environ.get('PRIVATE_KEY')
14-
PRIVATE_KEY_ID = os.environ.get('PRIVATE_KEY_ID')
15-
1613
credentials_dict = {
1714
"type": "service_account",
1815
"project_id": "cisl-vast-pythia",
19-
"private_key_id": str(PRIVATE_KEY_ID),
20-
"private_key": str(PRIVATE_KEY),
16+
"private_key_id": str(os.environ.get('PRIVATE_KEY_ID')),
17+
"private_key": str(os.environ.get('PRIVATE_KEY').replace('\\n', '\n')),
2118
"client_email": "[email protected]",
2219
"client_id": "113402578114110723940",
2320
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
@@ -46,15 +43,15 @@ def _run_total_users_report(property_id):
4643
return total_users
4744

4845

49-
def get_metrics(portal_id, foundations_id, cookbooks_id):
46+
def get_metrics():
5047
metrics_dict = {}
51-
metrics_dict['Portal'] = _run_total_users_report(str(portal_id))
52-
metrics_dict['Foundations'] = _run_total_users_report(str(foundations_id))
53-
metrics_dict['Cookbooks'] = _run_total_users_report(str(cookbooks_id))
48+
metrics_dict['Portal'] = _run_total_users_report(str(PORTAL_ID))
49+
metrics_dict['Foundations'] = _run_total_users_report(str(FOUNDATIONS_ID))
50+
metrics_dict['Cookbooks'] = _run_total_users_report(str(COOKBOOKS_ID))
5451

5552
with open('user_metrics.json', 'w') as outfile:
5653
json.dump(metrics_dict, outfile)
5754

5855

5956
if __name__ == '__main__':
60-
get_metrics(PORTAL_ID, FOUNDATIONS_ID, COOKBOOKS_ID)
57+
get_metrics()

0 commit comments

Comments
 (0)