ProjectPythia / projectpythia.github.io

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

String manipulation on GH secret in metrics automation AND contributor's instructions #414

Closed jukent closed 6 months ago

jukent commented 6 months ago

Related to #319 (won't close automatically, want to ensure the actions are all running smoothly after merge first). Response to #413

GH secrets treat new lines differently than the Google Analytics API key expects. Essentially '\' is an escape character, so sometimes during the encryption and getting of the secret, GitHub escapes the new line and causes issues. For some reason GH secrets when returned can give '\\n' where you'd expect '\n'.

Without printing the secret to ensure that this is the issue, I was able to confirm that the discrepancy in secret length aligns with extra '\'s. This PR will find any '\\n's and replace them with '\n'.

Maybe this was common knowledge, but I am amused that in this comment I have to add an extra '\' everywhere for it to show up as intended in the preview.

Updates to the contributor's guide for accessing the analytics API is also included in this PR.

jukent commented 6 months ago

Okay thanks I hope this works. I have to enter the secret on my fork and on the main repository, and I entered it probably 50 plus times between the two locations trying to fix this earlier.

if this doesn't work here is an action we can explore instead. https://github.com/google-github-actions/auth?tab=readme-ov-file#direct-wif