Skip to content

feat: Add new gh client implementation#3448

Open
stevehipwell wants to merge 6 commits into
integrations:mainfrom
stevehipwell:new-gh-client
Open

feat: Add new gh client implementation#3448
stevehipwell wants to merge 6 commits into
integrations:mainfrom
stevehipwell:new-gh-client

Conversation

@stevehipwell
Copy link
Copy Markdown
Collaborator

@stevehipwell stevehipwell commented May 26, 2026

Warning

This is a work in progress. There is a known issue for tests on resources that rely on other resources to mutate them not passing due to internal GitHub logic. These would be fixed by adopting a test strategy where the fixtures are created outside of Terraform.

Resolves #2925
Resolves #3103
Resolves #2709
Resolves #849


Before the change?

  • Legacy client implementation

After the change?

  • New client implementation (behind legacy_client = false provider setting)
    • Safer provider configuration
    • Refreshable app token
    • Transport level response cache
      • Persistable using cache_path provider setting
    • Idiomatic retry handling
    • Idiomatic rate limit handling
    • Base support for future multi-owner pattern

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@stevehipwell stevehipwell requested a review from deiga May 26, 2026 16:53
@stevehipwell stevehipwell self-assigned this May 26, 2026
@stevehipwell stevehipwell added Type: Feature New feature or request Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR labels May 26, 2026
@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

Copy link
Copy Markdown
Collaborator

@deiga deiga left a comment

Choose a reason for hiding this comment

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

This is looking quite nice!

Comment thread github/config.go Outdated
Comment thread github/provider.go
Comment thread github/provider.go
Elem: &schema.Schema{Type: schema.TypeInt},
Optional: true,
Description: "List of HTTP status codes that should be retried; if not set this uses the provider defaults. This setting only applies when `max_retries` is greater than `0`.",
Description: "List of HTTP status codes that should be retried; if not set this uses the provider defaults. This setting only applies when `max_retries` is greater than `0`. This is ignored for the REST API when `legacy_client` is `false` since the new client implementation handles the retry logic.",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: Would it make sense to add validation that these aren't set with legacy_client = false?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Just looking at the code, I don't think this is worth the effort given they have defaults.

Comment thread github/provider.go
Comment thread github/provider.go Outdated
Comment thread github/provider.go Outdated
Comment thread github/provider.go Outdated
Comment thread github/provider.go
return githubv4.NewClient(client), nil
}

return githubv4.NewEnterpriseClient(*opts.GraphQLURL, client), nil
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: Is NewEnterpriseClient correct here? Oh, it is, because is not nil, right?
I wonder if it would make sense to swap the condition and the "default" client to make the flow clearer?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We could do, but we always use the enterprise path. This can change when we remove legacy support.

@stevehipwell
Copy link
Copy Markdown
Collaborator Author

@deiga I've addressed most of your comments.

@stevehipwell stevehipwell requested a review from deiga May 29, 2026 09:21
@stevehipwell stevehipwell marked this pull request as ready for review May 29, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Projects

None yet

2 participants