Skip to content

Conversation

@amaanq
Copy link

@amaanq amaanq commented Jan 25, 2026

Hey, this is a bit of a drive-by PR but I think it's quite small in nature and fills in a gap that'd help with consistency. I've added support for overriding the data directory via a GH_DATA_DIR environment variable, which is akin to GH_CONFIG_DIR. This is nice for users who want a global/user-agnostic configuration, and don't want to pollute their home dirs. In my case, I want to manage extensions in a different directory than the default (I use NixOS and want to have my config be read-only in /etc/gh).

The precedence for locating the data dir is now GH_DATA_DIR --> XDG_DATA_HOME --> LocalAppData (Windows) --> HOME

While I was at it, I also fixed tests that suffered from environment pollution. I set GH_TOKEN and this was breaking some tests.

Thanks a ton!

N.B. If accepted, I can help update the main CLI repo with docs :)

Tests were inheriting environment variables from the host environment
(GH_TOKEN, GH_CONFIG_DIR, etc.), causing failures when these were set.
Explicitly clear these variables in each test to ensure isolation.
Add support for GH_DATA_DIR environment variable to customize the
data directory location, mirroring GH_CONFIG_DIR for config.

Data path precedence: GH_DATA_DIR → XDG_DATA_HOME → LocalAppData → HOME

This enables system-wide configuration on NixOS and other declarative
systems where config may be read-only in /etc/gh but data (extensions,
etc.) needs a separate writable location.
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.

1 participant