Skip to content

Read org members with GraphQL only in GitHub Actions - #317

Open
Ayomi-gh wants to merge 1 commit into
mainfrom
ayomi-gh/org-members-graphql-ci-only
Open

Ayomi-gh wants to merge 1 commit into
mainfrom
ayomi-gh/org-members-graphql-ci-only

Conversation

@Ayomi-gh

@Ayomi-gh Ayomi-gh commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

What

Org member lookups use GraphQL only when GITHUB_RUN_ID is set (GitHub Actions). Everywhere else they use REST again, as they did before 1.2.8. Version bumped to 1.2.9.

Why

1.2.8 (#314) switched org member lookups from REST to GraphQL everywhere, so that entitlements-caches could answer them in CI. That also changed production, where there is no cache. A production deploy then failed when GraphQL returned a 403 secondary rate limit on the second page of an org's members, and GraphQL errors are only retried on 5xx.

This keeps the CI benefit and puts production back on the 1.2.7 code path. GITHUB_RUN_ID is already read for the run ID header from #316, so there's no new setting.

Testing

  • bundle exec rspec spec/unit with GITHUB_RUN_ID unset: 199 examples, 0 failures, 100% coverage
  • GITHUB_RUN_ID=999 bundle exec rspec spec/unit: 199 examples, 0 failures, 100% coverage
  • bundle exec rubocop lib spec: no offenses

Production goes back to REST for org members, as in 1.2.7. GraphQL is
still used when GITHUB_RUN_ID is set so entitlements-caches can answer
CI lookups. Bump version to 1.2.9.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI auto review requested due to automatic review settings November 5, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The REST member-fetch order can miss users promoted between requests, leaving admin access in place without an entitlement until a later reconciliation.

1 open issue
What changed in this PR

This PR restores REST organization-member lookups outside GitHub Actions while preserving GraphQL access for CI caching.

Changes:

  • Selects GraphQL when GITHUB_RUN_ID is set and REST otherwise, preserving predictive-cache behavior.
  • Adds routing tests and updates existing mocks to use the API-selection method.
  • Bumps the plugin version to 1.2.9.
File Description
spec/​unit/​entitlements/​service/​github_spec.rb Tests API selection and updates cache-related expectations.
spec/​unit/​entitlements/​backend/​github_org/​controller_spec.rb Updates the reconciliation mock to use API selection.
lib/​version.rb Bumps the version to 1.2.9.
lib/​entitlements/​service/​github.rb Routes cache misses to GraphQL in Actions and REST elsewhere.
Gemfile.lock Records the updated plugin version.

Review effort: Balanced (auto)

Comment thread lib/entitlements/service/github.rb Resolved
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.

3 participants