Skip to content

Conversation

joestump
Copy link

@joestump joestump commented Jul 2, 2019

What does this PR do?

This adds a new resource for managing pre-receive hooks in GitHub Enterprise.

Example HCL

resource "github_repository_prereceive_hook" "code_reviews" {
  name        = "require-code-review"
  repository  = "hello-world"
  enforcement = "enabled"
}

TODO

  • Write integration tests
  • Update docs

@ghost ghost added the size/L label Jul 2, 2019
@ghost ghost added Type: Documentation Improvements or additions to documentation size/XL and removed size/L labels Jul 3, 2019
@joestump joestump changed the title WIP: Introduce a working github_repository_prereceive_hook resource Introduce a working github_repository_prereceive_hook resource Jul 3, 2019
Copy link
Contributor

@tracypholmes tracypholmes left a comment

Choose a reason for hiding this comment

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

It looks like we are getting a failure when running the tests. Here is the error

--- FAIL: TestAccGithubRepositoryPreReceiveHook_basic (4.78s)
    testing.go:568: Step 0 error: errors during apply:
        
        Error: GET https://api.github.com/repos/terraformtesting/foo-xd3xek6kxn/pre-receive-hooks?per_page=100: 404 Not Found []

})
}

func testAccCheckGitHubPreReceiveHookEnforcement(n string, enforcement string) resource.TestCheckFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required as we should be checking what's in state matches reality. This can be accomplished using an import state verifier

{
				ResourceName:      resourceName,
				ImportState:       true,
				ImportStateVerify: true,
			},

Copy link
Author

Choose a reason for hiding this comment

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

This is a check against the API; not state? I don't have an importer for this resource. I can skip validating against the API entirely though if that's preferred (I copied this pattern from the webhook tests).

@joestump
Copy link
Author

@tracypholmes this is a feature that's only available in GitHub Enterprise. I don't believe the main GitHub website supports this API endpoint. I ran the tests against our GHE install and they passed. I'll get the other comments addressed shortly. 👍

@ghost ghost removed the Awaiting response label Jul 18, 2019
@nickfloyd nickfloyd added the Status: Stale Used by stalebot to clean house label Nov 30, 2022
@nickfloyd
Copy link
Contributor

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot removed the Status: Stale Used by stalebot to clean house label Dec 11, 2022
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

👋 Hey Friends, this pull request has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Sep 8, 2023
@github-actions github-actions bot closed this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New resource size/XL Status: Stale Used by stalebot to clean house Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants