Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New resource: github_actions_organization_permissions #920

Merged

Conversation

j-nix
Copy link
Contributor

@j-nix j-nix commented Oct 1, 2021

This PR adds the following new resource for modifying Actions
permissions within a GitHub organization

New resource: github_actions_organization_permissions

Optional blocks allowed_actions_config and selected_actions_config
are only available when allowed_actions and/or enabled_repositories
are set to selected, respectively.

Default behaviour of the API when initializing the resource is to set
actions_allowed and enabled_repositories to all, this behaviour is
taken into account for destroy actions.

Documentation added.

Acceptance Tests Output:

--- PASS: TestAccGithubActionsOrganizationPermissions (60.67s)
    --- PASS: TestAccGithubActionsOrganizationPermissions/test_setting_of_basic_actions_organization_permissions (4.15s)
        --- PASS: TestAccGithubActionsOrganizationPermissions/test_setting_of_basic_actions_organization_permissions/with_an_organization_account (4.15s)
    --- PASS: TestAccGithubActionsOrganizationPermissions/imports_entire_set_of_github_action_organization_permissions_without_error (21.40s)
        --- PASS: TestAccGithubActionsOrganizationPermissions/imports_entire_set_of_github_action_organization_permissions_without_error/with_an_organization_account (21.40s)
    --- PASS: TestAccGithubActionsOrganizationPermissions/test_setting_of_organization_allowed_actions (6.28s)
        --- PASS: TestAccGithubActionsOrganizationPermissions/test_setting_of_organization_allowed_actions/with_an_organization_account (6.28s)
    --- PASS: TestAccGithubActionsOrganizationPermissions/test_setting_of_organization_enabled_repositories (28.83s)
        --- PASS: TestAccGithubActionsOrganizationPermissions/test_setting_of_organization_enabled_repositories/with_an_organization_account (28.83s)
PASS
ok      github.com/terraform-providers/terraform-provider-github/github 61.364s

Resource additionally has been extensively tested with real terraform operations on a test organization.

Although the API does not require the github_owned_allowed when specifying selected allowed_actions, I have enforced this to avoid nil errors in the case a user provides an empty allowed_actions_config {} block along with allowed_actions = "selected". If there is a better implementation for this, let me know.

Related to #489

j-nix added 3 commits October 1, 2021 19:27
This commit adds the following new resource for modifying Actions
permissions within a GitHub organization:

Resource: `github_actions_organization_permissions`

Optional blocks `allowed_actions_config` and `selected_actions_config`
are only available when `allowed_actions` and/or `enabled_repositories`
are set to `selected`, respectively.

Default behaviour of the API when initializing the resource is to set
`actions_allowed` and `enabled_repositories` to `all`, this behaviour is
taken into account for destroy actions.
Documentation added with examples for the new resource
`github_actions_organization_permissions`.
@jcudit jcudit added this to the v4.18.0 milestone Oct 5, 2021
@jcudit
Copy link
Contributor

jcudit commented Oct 5, 2021

Looking good so far. Have this on our queue to help verify tests are passing. Can you take a look at the linter error in the meantime?

@j-nix
Copy link
Contributor Author

j-nix commented Oct 11, 2021

Sure, I've pushed a fix for the linter error.

Bump to latest version of github go-sdk

Co-authored-by: Jeremy Udit <[email protected]>
Copy link
Contributor

@jcudit jcudit left a comment

Choose a reason for hiding this comment

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

🎃 great PR, thanks for the contribution.

@jcudit jcudit merged commit f1b749d into integrations:main Nov 8, 2021
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
* Issue 489: Support Actions Organization Permissions

This commit adds the following new resource for modifying Actions
permissions within a GitHub organization:

Resource: `github_actions_organization_permissions`

Optional blocks `allowed_actions_config` and `selected_actions_config`
are only available when `allowed_actions` and/or `enabled_repositories`
are set to `selected`, respectively.

Default behaviour of the API when initializing the resource is to set
`actions_allowed` and `enabled_repositories` to `all`, this behaviour is
taken into account for destroy actions.

* Issue 489: Add documentation for actions_organization_permissions

Documentation added with examples for the new resource
`github_actions_organization_permissions`.

* Remove side note leftover from development

* Remove unnecessary skipped tests

* Add link to website page tree

* Remove unnecessary conversion as per golangci-lint

* Update github/resource_github_actions_organization_permissions.go

Bump to latest version of github go-sdk

Co-authored-by: Jeremy Udit <[email protected]>

Co-authored-by: Jeremy Udit <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants