Skip to content

Conversation

joshhunt
Copy link
Contributor

@joshhunt joshhunt commented Sep 30, 2025

Resolves #2755

I'm not familiar with terraform provider development, so I'm not sure if there's anything else I'm missing, but this looked right to me.


Before the change?

After the change?

  • bypass_mode exempt is now supported!

Pull request checklist

  • 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?

  • Yes
  • No (I don't think so)

@krische
Copy link

krische commented Oct 2, 2025

Maybe don't replace the * with - in the markdown files? It makes it look like there are a lot more changes than there really are.

@joshhunt
Copy link
Contributor Author

joshhunt commented Oct 3, 2025

Ahh, thanks for catching that @krische. My IDE auto-formatted the markdown upon save and I didn't catch it 😅

Required: true,
ValidateFunc: validation.StringInSlice([]string{"always", "pull_request"}, false),
ValidateFunc: validation.StringInSlice([]string{"always", "pull_request", "exempt"}, false),
Description: "When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. Can be one of: `always`, `pull_request`.",
Copy link

Choose a reason for hiding this comment

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

I think the description needs to be updated too:

Suggested change
Description: "When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. Can be one of: `always`, `pull_request`.",
Description: "When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. Can be one of: `always`, `pull_request`, `exempt`.",

@oikarinen
Copy link
Contributor

@joshhunt are you working on requested changes? Would need this to go forward and happy to help.

@joshhunt
Copy link
Contributor Author

Thanks for the reminder @oikarinen. I fixed it!

@nickfloyd nickfloyd moved this from Backlog to In Progress in Terraform Provider Oct 21, 2025
@nickfloyd nickfloyd moved this from In Progress to In Review in Terraform Provider Oct 21, 2025
Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

We should follow up with some tests - there doesn't seem to be any coverage for any of the bypass_modes, this new one or otherwise 😬

@nickfloyd nickfloyd merged commit fe18870 into integrations:main Oct 21, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Terraform Provider Oct 21, 2025
@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Active Oct 21, 2025
@nickfloyd nickfloyd changed the title Add support for 'exempt' github_repository_ruleset bypass_mode feat: Add support for 'exempt' github_repository_ruleset bypass_mode Oct 21, 2025
oikarinen added a commit to oikarinen/terraform-provider-github that referenced this pull request Oct 22, 2025
Add test coverage for all three bypass_modes (always, pull_request,
exempt) for both repository and organization rulesets.

Repository Ruleset Tests (resource_github_repository_ruleset_test.go):
- Add test for all three bypass_modes with Team actors
- Add test for updating bypass_mode (always → exempt)
- Add test for different actor types with different bypass_modes
  (Team/always, RepositoryRole/pull_request, OrganizationAdmin/exempt)

Organization Ruleset Tests (resource_github_organization_ruleset_test.go):
- Fix existing "Creates and updates organization using bypasses" test:
  * Move bypass_actors from incorrect location (inside rules) to correct
    location (at ruleset level)
  * Add missing bypass_mode assertions
  * Fix incorrect actor_type assertions (was checking for "0", "5" instead
    of actual actor type strings)
  * Correct OrganizationAdmin actor_id from 0 to 1
- Add test for all three bypass_modes
- Add test for updating bypass_mode

All tests now verify:
- actor_id (both dynamic Team IDs and static role IDs)
- actor_type (Team, RepositoryRole, OrganizationAdmin, DeployKey)
- bypass_mode (always, pull_request, exempt)

This addresses the review comment from PR integrations#2764 requesting test coverage
for bypass_modes, including the newly added "exempt" mode.

Fixes: integrations#2764 (review)
@oikarinen
Copy link
Contributor

We should follow up with some tests - there doesn't seem to be any coverage for any of the bypass_modes, this new one or otherwise 😬

Hope this helps #2802

nickfloyd added a commit that referenced this pull request Oct 22, 2025
Add test coverage for all three bypass_modes (always, pull_request,
exempt) for both repository and organization rulesets.

Repository Ruleset Tests (resource_github_repository_ruleset_test.go):
- Add test for all three bypass_modes with Team actors
- Add test for updating bypass_mode (always → exempt)
- Add test for different actor types with different bypass_modes
  (Team/always, RepositoryRole/pull_request, OrganizationAdmin/exempt)

Organization Ruleset Tests (resource_github_organization_ruleset_test.go):
- Fix existing "Creates and updates organization using bypasses" test:
  * Move bypass_actors from incorrect location (inside rules) to correct
    location (at ruleset level)
  * Add missing bypass_mode assertions
  * Fix incorrect actor_type assertions (was checking for "0", "5" instead
    of actual actor type strings)
  * Correct OrganizationAdmin actor_id from 0 to 1
- Add test for all three bypass_modes
- Add test for updating bypass_mode

All tests now verify:
- actor_id (both dynamic Team IDs and static role IDs)
- actor_type (Team, RepositoryRole, OrganizationAdmin, DeployKey)
- bypass_mode (always, pull_request, exempt)

This addresses the review comment from PR #2764 requesting test coverage
for bypass_modes, including the newly added "exempt" mode.

Fixes: #2764 (review)

Co-authored-by: Nick Floyd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[FEAT]: github_repository_ruleset - support bypass_mode "exempt"

5 participants