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

feat: add GitHub-specific request headers #443

Merged
merged 4 commits into from
Feb 17, 2022

Conversation

kanadgupta
Copy link
Member

🧰 Changes

Refactors and enhances our fetch wrapper to add the x-readme-source header to all requests (the value defaults to cli). If it's in a GitHub Actions environment, it'll set that header to cli-gh.

Additionally, if in a GitHub Actions environment, it'll capture certain attributes about the environment and include that in the request headers as well. You can read more about all the environmental variables available to us here: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

🧬 QA & Testing

Do tests pass? Alternatively you can go to our project's Metrics dashboard, filter for requests using the rdme-test project's API key, and confirm the headers show up there (at least in the most recent requests after this PR was opened) 🎉

This felt a bit redundant, and this pattern will make it easier for us to add more headers more easily
We'll be using this in our fetch wrapper so let's extract it!
Also the header is now different depending on if it's in a GHA environment or not

Refactoring all fetch tests to check for multiple headers
@kanadgupta kanadgupta requested a review from erunion February 17, 2022 17:27
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

this rules

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