Skip to content

new resource: github_actions_repository_permissions#1339

Merged
kfcampbell merged 4 commits intointegrations:mainfrom
fatmcgav-depop:support_github_repo_actions
Nov 10, 2022
Merged

new resource: github_actions_repository_permissions#1339
kfcampbell merged 4 commits intointegrations:mainfrom
fatmcgav-depop:support_github_repo_actions

Conversation

@fatmcgav-depop
Copy link
Copy Markdown
Contributor

This commit adds the following new resources for modifying Actions
permissions for a given repository:

  • github_actions_repository_permissions

Resource is heavily modelled on the github_actions_organization_permissions
resource.

This commit adds the following new resources for modifying Actions
permissions for a given repository:

* `github_actions_repository_permissions`

Resource is heavily modelled on the `github_actions_organization_permissions`
resource.
@kfcampbell
Copy link
Copy Markdown
Contributor

Hi, thanks for contributing! When I run the integration tests following the instructions here, I'm seeing the following errors:

2022/10/27 11:31:37 [ERROR] <root>: eval: *terraform.EvalSequence, err: PUT https://api.github.com/repos/kfcampbell-terraform-provider/tf-acc-test-topic-jzrk1/actions/permissions: 422 Invalid request.

 is not a member of ["all", "local_only", "selected"]. []
ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
        
        (map[string]string) {
        }
        
        
        (map[string]string) (len=1) {
         (string) (len=10) "repository": (string) (len=23) "tf-acc-test-topic-hn20u"
        }

Can you reproduce these?

@nickfloyd nickfloyd added the Type: Feature New feature or request label Oct 31, 2022
@fatmcgav-depop
Copy link
Copy Markdown
Contributor Author

Can you reproduce these?

Sure, I'll take a look 👍

* Only specify `AllowedActions` if actions are enabled on repo
* Ensure that the `repository` param gets set when importing.
* Fix the logic when deleting the repository permissions.
@fatmcgav-depop
Copy link
Copy Markdown
Contributor Author

OK, tests are all passing now:

TF_ACC=true go test -run "^TestAccGithubActionsRepositoryPermissions$" ./github -v
=== RUN   TestAccGithubActionsRepositoryPermissions
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions/with_an_anonymous_account
    resource_github_actions_repository_permissions_test.go:51: anonymous account not supported for this operation
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions/with_an_individual_account
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions/with_an_organization_account
=== RUN   TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error
=== RUN   TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error/with_an_anonymous_account
    resource_github_actions_repository_permissions_test.go:117: anonymous account not supported for this operation
=== RUN   TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error/with_an_individual_account
=== RUN   TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error/with_an_organization_account
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions/with_an_anonymous_account
    resource_github_actions_repository_permissions_test.go:178: anonymous account not supported for this operation
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions/with_an_individual_account
=== RUN   TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions/with_an_organization_account
=== RUN   TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository
=== RUN   TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository/with_an_anonymous_account
    resource_github_actions_repository_permissions_test.go:229: anonymous account not supported for this operation
=== RUN   TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository/with_an_individual_account
=== RUN   TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository/with_an_organization_account
--- PASS: TestAccGithubActionsRepositoryPermissions (139.95s)
    --- PASS: TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions (32.66s)
        --- SKIP: TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions/with_an_individual_account (16.91s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/test_setting_of_basic_actions_repository_permissions/with_an_organization_account (15.74s)
    --- PASS: TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error (38.25s)
        --- SKIP: TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error/with_an_individual_account (18.90s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/imports_entire_set_of_github_action_repository_permissions_without_error/with_an_organization_account (19.35s)
    --- PASS: TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions (38.17s)
        --- SKIP: TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions/with_an_individual_account (18.74s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/test_setting_of_repository_allowed_actions/with_an_organization_account (19.42s)
    --- PASS: TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository (30.88s)
        --- SKIP: TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository/with_an_individual_account (15.50s)
        --- PASS: TestAccGithubActionsRepositoryPermissions/test_disabling_actions_on_a_repository/with_an_organization_account (15.38s)
PASS
ok      github.com/integrations/terraform-provider-github/v5/github     140.882s

@kfcampbell
Copy link
Copy Markdown
Contributor

Looks good to me too, thank you for contributing!

@kfcampbell kfcampbell merged commit fc51853 into integrations:main Nov 10, 2022
@fatmcgav-depop fatmcgav-depop deleted the support_github_repo_actions branch November 14, 2022 10:26
@fatmcgav-depop
Copy link
Copy Markdown
Contributor Author

Thanks for that @kfcampbell ... Do you know when the next release is scheduled for?

kazaker pushed a commit to auto1-oss/terraform-provider-github that referenced this pull request Dec 28, 2022
* new resource: github_actions_repository_permissions

This commit adds the following new resources for modifying Actions
permissions for a given repository:

* `github_actions_repository_permissions`

Resource is heavily modelled on the `github_actions_organization_permissions`
resource.

* Fixup the failing tests.

* Only specify `AllowedActions` if actions are enabled on repo
* Ensure that the `repository` param gets set when importing.
* Fix the logic when deleting the repository permissions.

* Fixup merge

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
* new resource: github_actions_repository_permissions

This commit adds the following new resources for modifying Actions
permissions for a given repository:

* `github_actions_repository_permissions`

Resource is heavily modelled on the `github_actions_organization_permissions`
resource.

* Fixup the failing tests.

* Only specify `AllowedActions` if actions are enabled on repo
* Ensure that the `repository` param gets set when importing.
* Fix the logic when deleting the repository permissions.

* Fixup merge

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants