Skip to content

Conversation

@deiga
Copy link
Contributor

@deiga deiga commented Dec 7, 2025

Warning

This is waiting for #2986 to be merged and rebased to go-github-v68

Resolves #2530, #2536, #2717


Before the change?

  • Running TEST="./github" TESTARGS="-run TestGithubOrganizationRulesets" make testacc would fail due to multiple issues in the test setup

After the change?

  • Running TEST="./github" TESTARGS="-run TestGithubOrganizationRulesets" make testacc will show all tests as passing
  • Switch from NewSubsystemLoggingHTTPTransport to NewLoggingHTTPTransport as we don't actually initialize a Subsystem anywhere, which creates spam.
  • Tests for Organizations properly use GITHUB_TEST_ORGANIZATION and GITHUB_TEST_OWNER
  • Migrate github/resource_github_organization_ruleset.go and github/resource_github_repository.go to use Context aware CRUD methods
  • Add rules.pull_requests.allowed_merge_methods handling to github/resource_github_repository_ruleset.go and github/resource_github_organization_ruleset.go

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-ish
  • No

The addition of a new required rules property: allowed_merge_methods does kind of constitute a breaking change. It is also entirely necessary as that field isn't omitted by the SDK and it's required by the API.


deiga added 20 commits December 7, 2025 16:48
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…rks properly

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…sport`

Updated the logging transport in the RateLimitedHTTPClient function to use NewLoggingHTTPTransport. As the subsystem would need to be explicitly inititated in each resource

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
By using the `*Context` CRUD functions we get context pass-through and enable HTTP Req/Resp Debug logging

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
It's a required field in the API and go-github doesn't use `omitempty`, so it submits `nil` if it isn't sent explicitly.

This change tries to keep it in the state, without having a configuration option for it (poor choice?)

And it defaults to all 3 available merge methods if it can't set something from the state.

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
This is a required field and the SDK doesn't omit if it's empty

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
This enables better debugging during tests as we are able to use get logs for HTTP req/resp

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…on_rulesets_without_errors` to pass

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
@github-actions
Copy link

github-actions bot commented Dec 7, 2025

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

@github-actions github-actions bot added the Type: Bug Something isn't working as documented label Dec 7, 2025
@deiga deiga changed the title Ensure tests use GITHUB_TEST_* values for Owner and Organization [MAINT] Fix Org Ruleset tests Dec 7, 2025
@deiga deiga marked this pull request as ready for review December 7, 2025 18:14
deiga added 5 commits December 7, 2025 20:34
…null`

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…_all_bypass_modes`

Main fix: `bypass_actors` is returned as sorted from GH API so tests need re-indexing

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
@stevehipwell
Copy link
Collaborator

@deiga would it be possible to hold off on this until we get #2941 merged?

@deiga
Copy link
Contributor Author

deiga commented Dec 8, 2025

@deiga would it be possible to hold off on this until we get #2941 merged?

@stevehipwell Sure! Would you want to rebase that branch on top of go-github-v68, so that I could use it as a base for this PR?

@stevehipwell
Copy link
Collaborator

@deiga the acceptance tests PR should be compatible with the v6 releases, so the v7 branch would be rebased on it. I'm currently re-running the tests to get it ready to be merged and I'm picking up defects in the currently released code.

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.

2 participants