Skip to content

optionally authenticate against github api during install #1337

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

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

eviltwin
Copy link
Contributor

When running in a CI environment we sometimes experience rate limiting from the GitHub API when trying to run direnv's install.sh. This causes the whole build to fail, which can be frustrating.

The Homebrew project has previously worked around a similar issue by allowing the user to optionally authenticate using their personal GitHub account, which results in a higher rate limit on API usage. (See HOMEBREW_GITHU_API_TOKEN docs here: https://docs.brew.sh/Manpage).

This PR introduces a similar optional environment variable for direnv's install.sh script, which will allow us to inject a dedicated authentication token into our CI builds and avoid spurious failures.

I wasn't sure if you'd want a note added in docs/installation.md - please just let me know if you would and I'll add it.

The only other thing that I'm just noticing is that it seems that the convention in this script is for lower case environment variables as inputs - would you like me to change that?

@eviltwin
Copy link
Contributor Author

@zimbatm Thanks, hadn't thought to use the array syntax. What're your thoughts on the variable name/casing as well as the need to mention this in the docs?

@zimbatm zimbatm merged commit fc27fd4 into direnv:master Mar 25, 2025
5 checks passed
@d
Copy link

d commented Mar 27, 2025

Hello, this breaks environments running BASH versions 3 and 4, as empty arrays were considered unset variables

zimbatm added a commit that referenced this pull request Mar 27, 2025
@zimbatm
Copy link
Member

zimbatm commented Mar 27, 2025

Mind taking a look at #1406 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants