Skip to content

Commit 27bcd54

Browse files
committedMar 20, 2024
fix malformed key
1 parent 4137c00 commit 27bcd54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

Diff for: ‎.github/workflows/get-metrics.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
# Access Secrets
2222
PRIVATE_KEY_ID = os.environ.get('PRIVATE_KEY_ID')
23-
PRIVATE_KEY = os.environ.get('PRIVATE_KEY')
23+
# Ensure that GH secret doesn't introduce extra new line characters (related to '\' being an escape character)
24+
PRIVATE_KEY = os.environ.get('PRIVATE_KEY').replace('\\n', '\n')
2425

2526
credentials_dict = {
2627
'type': 'service_account',
@@ -41,7 +42,7 @@
4142
except google.auth.exceptions.MalformedError as e:
4243
print('Malformed Error:', repr(e))
4344
# Insight into reason for failure without exposing secret key
44-
print('Length of PRIVATE_KEY:', len(PRIVATE_KEY)) # 0: Secret not found, ~734: Secret malformed
45+
print('Length of PRIVATE_KEY:', len(PRIVATE_KEY)) # 0: Secret not found, ~732-734: Secret malformed
4546

4647
pre_project_date = '2020-03-31' # Random date before project start
4748

0 commit comments

Comments
 (0)