Skip to content

[MAINT]: actor_id for OrganizationAdmin seems to have changed from 1 to 0 #2536

Closed

Description

@stempler

Describe the need

Since a couple of days I'm getting changes shown on terraform plan related to rulesets that use the actor_type OrganizationAdmin in the bypass actors.

For example:

...

      ~ bypass_actors {
          ~ actor_id    = 0 -> 1
            # (2 unchanged attributes hidden)
        }

        # (7 unchanged blocks hidden)
    }

Plan: 0 to add, 110 to change, 0 to destroy.

It seems the actor_id used internally in Github for OrganizationAdmin changed from 1 to 0.

Changing my configurations from 1 to 0 again leads to "no changes" detected as expected.
Applying with the 1 still present did not lead to any errors, so I would assume this is not a breaking change related to creating/updating this kind of resources.

I guess for this project the main impact would be that the documentation would need to be updated to refer to 0 instead of 1.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    Status: Triage
    Type: Maintenance
    on Jan 13, 2025
  2. stevehipwell commented on Jan 14, 2025

    @stevehipwell
    Collaborator

    I added a comment to github/rest-api-description#4406 as this could be a regression as the GitHub API docs still explicitly say to use 1.

  3. Danielku15 commented on Jan 14, 2025

    @Danielku15
    Contributor

    We're on GHES 3.15.1 within my work place. After creating a ruleset manually with OrganizationAdmin added it has "actor_id": 1.

    Image

    I just did the same on github.com in one of my repos, and there it has "actor_id": null.

    Image

  4. stevehipwell commented on Jan 14, 2025

    @stevehipwell
    Collaborator

    FYI @Danielku15 null will be represented as 0 in a Go int.

  5. Danielku15 commented on Jan 14, 2025

    @Danielku15
    Contributor

    Yes, I've noticed that in some places the null values are represented as 0 in the models for simplicity. But if not handled correctly on the api calls, it can lead to bugs like #2317

    Null and 0 can have different semantics on the github api leading to validation errors when sending the wrong data.

  6. stevehipwell commented on Jan 14, 2025

    @stevehipwell
    Collaborator

    @Danielku15 in this context if null is being treated as anything other than 0 then it's a bug as the GH Go SDK treats it as an int which can't be represented as null.

  7. Danielku15 commented on Jan 15, 2025

    @Danielku15
    Contributor

    @stevehipwell True, in this context things should be fine. It appears also for me #2317 disappeared on our GHES after upgrade to 3.15. In my previous tests and troubleshooting it appeared that a 0 value on integration_id somehow sneaked through some checks and was ultimately sent to the API.

    GH Go SDK uses *int64 to differenciate between null and 0 values, hence setting 0 without a check when mapping from Terraform structures to API structures can lead to problems.

  8. stevehipwell commented on Jan 15, 2025

    @stevehipwell
    Collaborator

    GH Go SDK uses *int64 to differenciate between null and 0 values, hence setting 0 without a check when mapping from Terraform structures to API structures can lead to problems.

    @Danielku15 you're right, I've been working in both the SDK and TF provider so my memory was slightly off. I'm planning on re-implementing the ruleset code once google/go-github#3430 has been merged & released. One of the things I'm planning on doing is supporting not requiring the actor ID for well known actors.

  9. fatbasstard commented on Jan 30, 2025

    @fatbasstard
    Contributor

    Seeing the same here:

    ~ bypass_actors {
      ~ actor_id :0 -> 5
      ~ actor_type : "OrganizationAdmin" -> "RepositoryRole"
      bypass_mode : "always"
      }
    ~ bypass_actors {
      ~ actor_id : 5 -> 1
      ~ actor_type : "RepositoryRole" -> "OrganizationAdmin"
      bypass_mode : "always"
      }

    It's even a bit more annoying since we also set the RepositoryRole to Admin (source) which seems to flip over the configuration even worse.

  10. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Feb 27, 2025
  11. sthompson0 commented on Oct 1, 2025

    @sthompson0

    This makes noisy output in terraform plans that confuses end users. Any chance this will be fixed in the near future?
    google/go-github#3430 has been merged. Has it been released yet?

  12. sthompson0 commented on Oct 10, 2025

    @sthompson0

    @stevehipwell Is setting the actor_id to 0 an appropriate local fix, or will this end up causing a bug later if this is ever addressed?

  13. stevehipwell commented on Oct 13, 2025

    @stevehipwell
    Collaborator

    @sthompson0 this is what we've been doing since January, AFAIK there isn't another solution to this.

  14. deiga commented on Dec 7, 2025

    @deiga
    Collaborator

    My current suggestion is to "swallow" the 0 value inside the provider and just keep acting like it's 1. See: 9d22505

  15. stevehipwell commented on Dec 8, 2025

    @stevehipwell
    Collaborator

    @deiga we'd need to make this support both 0 & 1 as I'd expect most people to have switched over to using 0 (we have).

  16. deiga commented on Dec 8, 2025

    @deiga
    Collaborator

    @deiga we'd need to make this support both 0 & 1 as I'd expect most people to have switched over to using 0 (we have).

    @stevehipwell That's a good point! I'll check how to do that reasonably

  17. stevehipwell commented on Dec 8, 2025

    @stevehipwell
    Collaborator

    @deiga the simplest pattern would be to never swap 1 & 0 in state (e.g. if the current value is <= 1, either from user input or API response, then only update it if the new value is > 1). A custom diff suppression could be used but would be more complex and may have unintended consequences in the future.

  18. matheuss commented on Mar 22, 2026

    @matheuss

    FWIW adding some evidence: on github.com/vercel, we see null as the actor ID:

    gh api "repos/vercel/agents/rulesets/$id"| jq '{id,name,bypass_actors:(.bypass_actors | map({actor_id,actor_type,bypass_mode}))}'
    {
      "id": 13810570,
      "name": "Require Approvals (Managed by Terraform)",
      "bypass_actors": [
        {
          "actor_id": null,
          "actor_type": "OrganizationAdmin",
          "bypass_mode": "pull_request"
        },
        ...
      ]
    

    That causes every Terraform plan to try and change it to 1 indeed, as folks previously reported here 😮‍💨

  19. deiga commented on Mar 22, 2026

    @deiga
    Collaborator

    The upstream API has changed actor_id to null for OrganizationAdmin which AFAIK has resolved this.
    At least I've stopped seeing drift from this id after we removed it from our config

  20. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon Mar 22, 2026
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

    Status: TriageType: Maintenance

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions