Skip to content

Feature/include all branches#1120

Closed
KensoDev wants to merge 1 commit intointegrations:mainfrom
hippo-oss:feature/include-all-branches
Closed

Feature/include all branches#1120
KensoDev wants to merge 1 commit intointegrations:mainfrom
hippo-oss:feature/include-all-branches

Conversation

@KensoDev
Copy link
Copy Markdown
Contributor

When creating a repository from a template, you can pass in a boolean to
include all the branches in the template repo.

This is documented here: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template

In addition, the provider already supports that here: https://github.com/google/go-github/blob/3e8a7f0fbe0e4402f9ad5a80e0ab0a050786e0f8/github/repos.go#L441

Adding a variable under the template structure and then pass it in to
the provider function works.

This PR includes tests + docs for the new addition. It is backward compatible with the previous behavior

When creating a repository from a template, you can pass in a boolean to
include all the branches in the template repo.

This is documented here: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template

In addition, the provider already supports that here: https://github.com/google/go-github/blob/3e8a7f0fbe0e4402f9ad5a80e0ab0a050786e0f8/github/repos.go#L441

Adding a variable under the template structure and then pass it in to
the provider function works.

Added tests to make sure it works. All tests are passing
@KensoDev KensoDev force-pushed the feature/include-all-branches branch from 38cc636 to bc14aa3 Compare April 20, 2022 17:24
@kfcampbell
Copy link
Copy Markdown
Contributor

@KensoDev do you mind allowing edits by maintainers? I'd like to merge main in and make some updates to the integration test, which is failing for me. If you'd prefer not to, I'm happy to open a new PR as well. Thanks!

@KensoDev
Copy link
Copy Markdown
Contributor Author

@KensoDev do you mind allowing edits by maintainers? I'd like to merge main in and make some updates to the integration test, which is failing for me. If you'd prefer not to, I'm happy to open a new PR as well. Thanks!

Happy to. How do I allow maintainers to do that?

@kfcampbell
Copy link
Copy Markdown
Contributor

You should have a checkbox in the lower right corner of the Conversation page near the settings for your notifications. Here's an example of what I see on #1340:

image

@KensoDev
Copy link
Copy Markdown
Contributor Author

I do not have this option. Feel free to pull this work and create a new PR from it.
I am also happy to run integration tests and fix if that's possible.

@KensoDev
Copy link
Copy Markdown
Contributor Author

@kfcampbell I manually added you with write access to the repository. Let me know if that helps.

@kfcampbell
Copy link
Copy Markdown
Contributor

That's bizarre! I wonder why.

For the tests: I'm following the instructions here and exporting TF_ACC=1, TF_LOG=DEBUG, GITHUB_ORGANIZATION={myOrg}, and GITHUB_TOKEN={myToken}.

When running go test -v ./... -run ^TestAccGithubRepositories, I see the following failure:

    --- FAIL: TestAccGithubRepositories/creates_a_repository_using_a_template_and_all_branches (53.46s)
        --- SKIP: TestAccGithubRepositories/creates_a_repository_using_a_template_and_all_branches/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubRepositories/creates_a_repository_using_a_template_and_all_branches/with_an_individual_account (20.04s)
        --- FAIL: TestAccGithubRepositories/creates_a_repository_using_a_template_and_all_branches/with_an_organization_account (16.13s)

with the error: testing.go:705: Step 0 error: Check failed: Check 1/1 error: github_repository.test: Attribute 'template.include_all_branches' not found`.

Can you reproduce that error? (Some additional archiving integration tests are failing, but that's not related.)

@kfcampbell
Copy link
Copy Markdown
Contributor

I'm really torn about the test for this. A good test would probably go fetch the github_branch data source for the repository and confirm that multiple branches were copied over. That might be particularly onerous since it requires a template repository set with multiple branches in the organization.

@kfcampbell
Copy link
Copy Markdown
Contributor

kfcampbell commented Oct 27, 2022

@peter-murray I haven't forgotten about this. I'm tempted to merge and release this without an explicit test given the somewhat trivial nature of the actual change.

@kfcampbell
Copy link
Copy Markdown
Contributor

@KensoDev are you sure you don't see a checkbox to give maintainers access anywhere on the PR? I'd like to play with this a bit and ideally wouldn't create a new PR so you'd become a contributor when this behavior is merged.

@KensoDev
Copy link
Copy Markdown
Contributor Author

KensoDev commented Oct 27, 2022 via email

@kfcampbell
Copy link
Copy Markdown
Contributor

Closing in favor of #1353.

@kfcampbell kfcampbell closed this Nov 9, 2022
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