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_organization_project #111

Merged
merged 5 commits into from
Aug 9, 2018

Conversation

shihanng
Copy link
Contributor

@shihanng shihanng commented Aug 4, 2018

Hi, this PR adds the ability to manage organization projects to this provider as described in https://developer.github.com/v3/projects/#create-an-organization-project. This is my first time working with Terraform provider, please let me know if I miss anything. Thank you.

@radeksimko radeksimko changed the title add r/github_organization_project New Resource: github_organization_project Aug 7, 2018
@shihanng
Copy link
Contributor Author

shihanng commented Aug 8, 2018

It seems that there is conflict. Would you like me to rebase on master?

@radeksimko
Copy link
Contributor

@shihanng yes, I merged a few PRs lately and I'm going through others, including this one. I'm going to review it regardless, but rebasing would be incredibly helpful.

Thanks!

Copy link
Contributor

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thanks for this PR. It is overall in a pretty good shape! 🙂
Acceptance test is passing.

I left you some comments/questions in-line. Let me know when it's ready for another look.

"url": {
Type: schema.TypeString,
Computed: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you feel about coverage of the remaining fields which are available through PATCH?
https://developer.github.com/v3/projects/#update-a-project
specifically state, organization_permission and public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔 It seems that the library that we are using does now support these fields yet?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, understood. Thanks for the detailed answer & research. We shall leave it out for the initial implementation then.

options := github.ProjectOptions{
Name: n,
Body: b,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick (non-blocking): I think we could just inline the fields above to the struct to reduce LOC and improve readability a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f1a04f4, thank you.

options := github.ProjectOptions{
Name: n,
Body: b,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick - as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f1a04f4, thank you.


* `name` - The name of the project.

* `body` - The body of the project.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please document whether each field is Optional or Required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 2ea7426. Thanks!

},
})
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind adding a test for import also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added test for import in ec08678. Thank you.


d.Set("name", project.GetName())
d.Set("body", project.GetBody())
d.Set("url", fmt.Sprintf("https://github.com/orgs/%s/projects/%d", o, project.GetNumber()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason we should be constructing the URL here instead of reading it from the API? It appears that html_url is the attribute we could use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, but it is not made available in the go-github library? See Project.

@shihanng shihanng force-pushed the organization_project branch from 4911f9b to 8972a54 Compare August 9, 2018 00:09
@shihanng shihanng force-pushed the organization_project branch from 8972a54 to 2ea7426 Compare August 9, 2018 01:42
@shihanng
Copy link
Contributor Author

shihanng commented Aug 9, 2018

@radeksimko, thank you for the reviews. I've addressed some comments in code, and also the rest as comments. Also rebased on master. Could you please take another look. Thank you.

Copy link
Contributor

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Thank you for making all the changes promptly.

FYI I have opened google/go-github#969 to add the missing fields you mentioned, so we can update the resource code later, when it lands.

@radeksimko radeksimko merged commit 149a615 into integrations:master Aug 9, 2018
@shihanng
Copy link
Contributor Author

shihanng commented Aug 9, 2018

Thank you so much 😄! I will work on #115 later on and ping you again when it is ready.

@shihanng shihanng deleted the organization_project branch August 9, 2018 07:16
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
* r/github_organization_project: first commit

* r/github_organization_project: add docs

* add import test for github_organization_project

* inline struct fields for readability

* docs: update fields with Required/Optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants