Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

jukent
Copy link
Contributor

@jukent jukent commented Mar 20, 2024

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 jukent requested a review from erogluorhan March 20, 2024 13:08
@jukent jukent requested a review from a team as a code owner March 20, 2024 13:08
@jukent jukent requested review from ktyle and removed request for a team March 20, 2024 13:08
@jukent jukent requested a review from a team as a code owner March 20, 2024 13:39
@jukent jukent requested review from clyne and removed request for a team March 20, 2024 13:39
@jukent jukent changed the title String manipulation on GH secret in metrics automation String manipulation on GH secret in metrics automation AND contributor's instructions Mar 20, 2024
Copy link
Member

@erogluorhan erogluorhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, approved. Though I am curious how the secret first worked in your fork, and whether we can find an alternative more preferable way than string manipulation, let us aim at getting the wheels turning for now.

@jukent
Copy link
Contributor Author

jukent commented Mar 20, 2024

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

@jukent jukent merged commit 935e1d3 into ProjectPythia:main Mar 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants