Skip to content

fix: Keep ruleset bypass_actors in state when the API omits them - #3688

Closed
rriski wants to merge 1 commit into
integrations:mainfrom
rriski:fix/ruleset-omitted-bypass-actors
Closed

rriski wants to merge 1 commit into
integrations:mainfrom
rriski:fix/ruleset-omitted-bypass-actors

Conversation

@rriski

@rriski rriski commented Oct 19, 2026

Copy link
Copy Markdown

Resolves #3687


Before the change?

  • GitHub omits bypass_actors from a ruleset response when the caller cannot administer the ruleset. Read wrote an empty list in that case, so a plan run with a read-only token always proposed adding the configured bypass actors.

After the change?

  • Read leaves bypass_actors in state untouched when the response omits the key. An explicit "bypass_actors": [], which an admin caller receives for a ruleset without bypass actors, still clears state, so drift detection for admin callers is unchanged.
  • Applies to github_repository_ruleset and github_organization_ruleset.

AI use

This change and its tests were written with an AI coding assistant (Claude Code) and reviewed by me before submitting. The omitted-versus-empty behaviour was checked against the live API with an admin and a non-admin token: the non-admin response has no bypass_actors key, while the admin response has "bypass_actors": [] for a ruleset without bypass actors. The new unit tests fail without the change and pass with it.

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

GitHub omits bypass_actors from a ruleset response when the caller cannot
administer the ruleset, and returns an empty array when an admin reads a
ruleset without bypass actors. Read wrote an empty list in both cases, so a
plan with a read-only token always proposed adding the configured actors.

Fixes integrations#3687
@github-actions

Copy link
Copy Markdown

👋 Hi, and thank you for this contribution!

This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.

You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions.


🤖 This is an automated message.

@github-actions github-actions Bot added the Type: Bug Something isn't working as documented label Oct 19, 2026
@ethanchmews

Copy link
Copy Markdown

This would be awesome, not having this makes it harder for us to have a proper secure way to manage our repos with terraform

@robert-crandall

Copy link
Copy Markdown
Contributor

Thanks for putting this PR together and taking the time to contribute!

We're temporarily moving to an issue-first model (see CONTRIBUTING.md) where only collaborators can open PRs while we work through the backlog. Because of that, I'm going to close this PR for now.

I've linked it on #3687 so we don't lose your work or context when we pick that issue up. Feel free to add a 👍 or any extra notes there to help us prioritize it.

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

Labels

Type: Bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Ruleset bypass_actors drift on every plan when the token cannot administer the ruleset

3 participants