ProjectPythia / projectpythia.github.io

https://projectpythia.org
Apache License 2.0
32 stars 19 forks source link

Add comments to metrics code and add error handling #413

Closed jukent closed 6 months ago

jukent commented 6 months ago

Adds a try-except block to help debug if github secret isn't being accessed or is malformed

Adds comments and docstrings throughout.

Still need to update contributing guide.

jukent commented 6 months ago

Thanks for the review @erogluorhan because of this I can tell that the length of our key is 1732. This is good news because I was afraid it would return a length 0 or be unable to find the secret, which is a much harder problem to solve.

One discrepancy in the key that I encountered is sometimes all of the '\n' characters added to a GH secret are rendered as '\n'. I don't completely know why this is, but I saw it come up a lot when I was wrestling with this malformed key error. Perhaps it is because in secrets '\' is an escape character, or something is lost during the encryption.

Incidentally, if I take the known key and replace those characters locally, it has length 1732. I'm going to add a quick string manipulation in another PR that should ensure our key has one slash instead of two.