Skip to content

Tell extensions when they are run as extensions and not standalone #14071

Closed

Description

@heaths

Describe the feature or problem you’d like to solve

Perhaps I'm being pedantic, but I'd love to show correct usage for my Go-based extensions when they are run either standalone or as a gh extension.

Proposed solution

Have gh set an environment variable GH_EXTENSION=1 when calling an extension. The extension can easily check this cross-platform to vary usage.

Activity

  1. added
    needs-triage
    on Aug 5, 2026
  2. cli-triage commented on Aug 5, 2026

    @cli-triage

    This looks like an enhancement request: the author wants gh to set a GH_EXTENSION=1 (or similar) environment variable when invoking an extension, so extension authors can detect whether their program is running as a gh extension or directly as a standalone binary. No duplicates were found. Suggesting the enhancement label for maintainer approval.

    Generated by Issue Triage (skills-driven) for #14071 · sonnet46 · 19.6 AIC · ⌖ 4.05 AIC · ⊞ 6.6K · ◷

  3. added
    enhancement
    on Aug 5, 2026
  4. removed
    needs-triage
    on Aug 5, 2026
  5. github-actions commented on Aug 5, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  6. williammartin commented on Aug 5, 2026

    @williammartin
    Member

    Acceptance criteria

    Given I have an extension installed that prints the value of the GH_EXTENSION env var
    When I run gh <my ext>
    Then I see that GH_EXTENSION is set to 1

    Given I have an extension installed that prints the value of the GH_EXTENSION env var
    When I run gh extension exec <my ext>
    Then I see that GH_EXTENSION is set to 1

    Given I have an extension installed that prints the value of the GH_EXTENSION env var
    When I run the extension directly (not via gh)
    Then I see that GH_EXTENSION is set to 0

    When I run gh help environment
    Then I see that the GH_EXTENSION env var is documented

  7. williammartin commented on Aug 5, 2026

    @williammartin
    Member

    Hope #14072 works for you @heaths, otherwise we can iterate on it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions