Skip to content

[MAINT]: Refactor github_repository resource #3133

Open
3 of 7 issues completed
Open

Description

@stevehipwell

Describe the need

The github_repository resource needs to be refactored to follow best practice including not calling update & read after create or read after update. This will allow us to refactor the logic as there will be separation between the lifecycles.

SDK Version

No response

API Version

No response

Relevant log output

Code of Conduct

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

Sub-issues

Sub-issues

3 of 7 Issues completed
Loading 7 sub-issues

Activity

  1. added
    Type: Maintenance
    on Jan 27, 2026
  2. github-actions commented on Jan 27, 2026

    @github-actions

    👋 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! 🚀

  3. deiga commented on Jan 28, 2026

    @deiga
    Collaborator

    Due to the nature of the Repo create API endpoint all repo settings can't be set during create, which is why it calls update to manage the "rest" of the settings.

    With that in mind, what do we think about separating repo and repo_settings into 2 resources? Similar to ORG and org_settings

  4. stevehipwell commented on Jan 28, 2026

    @stevehipwell
    CollaboratorAuthor

    @deiga which settings are you thinking of? Off the top of my head vulnerability alerts and pages need new resources. I'd also be tempted to move topics into their own resource. Have I missed any other settings?

  5. deiga commented on Jan 29, 2026

    @deiga
    Collaborator

    @deiga which settings are you thinking of? Off the top of my head vulnerability alerts and pages need new resources. I'd also be tempted to move topics into their own resource. Have I missed any other settings?

    Naive approach: The diff between github.createRepoRequest and github.Repository. That would ensure that we wouldn't have to call the Create and Edit endpoint in the Create function.
    But that might be too naive 😬
    And the overlap could be hard to fathom

  6. stevehipwell commented on Jan 30, 2026

    @stevehipwell
    CollaboratorAuthor

    @deiga it's not that simple, the github.Repository type has all possible fields for a repository. We'd probably need to look at the docs to get a full understanding. But basically the "create" function SHOULD NOT call the "update" function even if we need to hit a second endpoint on create.

  7. deiga commented on Jan 30, 2026

    @deiga
    Collaborator

    @deiga it's not that simple, the github.Repository type has all possible fields for a repository. We'd probably need to look at the docs to get a full understanding. But basically the "create" function SHOULD NOT call the "update" function even if we need to hit a second endpoint on create.

    Definitely agree on the latter point.
    And I think moving everything out isn't a great option either.

    Some potential ones in addition to the mentioned ones:

    • security_and_analysis: Since these can be limited by organization/enterprise maybe it could be a nicer UX to manage these as a separate resource
    • topics: Since they anyway need to be managed by a separate endpoint
  8. deiga commented on Feb 8, 2026

    @deiga
    Collaborator

    I just realised that topics already have an existing resource, so we can just deprecate the field

  9. added theissue type on Feb 8, 2026
  10. deiga commented on Feb 11, 2026

    @deiga
    Collaborator

    I linked #2090 as I think the refactor could include changes to how template changes are being enacted.
    Steve mentions that changing template should probably recreate the github_repository resource and I think that sounds reasonable

  11. deiga commented on Feb 11, 2026

    @deiga
    Collaborator

    These changes should resolve #2604 as we reduce the API calls

  12. robogoblin commented on Mar 27, 2026

    @robogoblin

    Is there any movement on this?

  13. deiga commented on Mar 27, 2026

    @deiga
    Collaborator

    There are PRs for extracting pages and vulnerability alerts to separate resources. Once those are finalized it makes sense to do first round of modernization in github_repository

  14. robogoblin commented on Mar 28, 2026

    @robogoblin

    Any reason we can't have a temp fix for now, like a retry or even a sleep for 1 second would likely fix the issue. I can't use a sleep in the resource chain because it's within the code of a resource. However as I said in the original issue, if you are geographically further away from the API then everything works. So we are talking about a very small amount of time, likely not even noticeable to a human to fix this.

    I understand that you want to do a real fix, but we currently have an issue that is really easy to fix, but we are now waiting for all these other PRs to come in. It's been months already since I first made the issue. That's a long time to wait for what feels like a few of lines of code.

  15. deiga commented on Mar 28, 2026

    @deiga
    Collaborator

    @robogoblin please take into account that we maintain this as a community effort. We give our free time to this project.

    And for a really long while there was no active maintenance going on.
    There is a lot of cruft that needs to be addressed. Which is why we don't generally do "quick fixes" as there isn't easy to just iterate on them.

    If you have a critical need for a fix, please feel free to submit a PR.

  16. robogoblin commented on Mar 28, 2026

    @robogoblin

    Firstly, thank you for your effort to maintain this, I don't mean to come off as harsh.

    I'll do a PR for a temp fix that we can use and then test it with the workflow that I have already.

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

    Type: Maintenance

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions