Skip to content

feat: Add support for team memberships. - #95

Merged
acch merged 1 commit into
svalabs:mainfrom
kadaster:feat/team-membership
Mar 7, 2026
Merged

feat: Add support for team memberships.#95
acch merged 1 commit into
svalabs:mainfrom
kadaster:feat/team-membership

Conversation

@kad-hollac1

Copy link
Copy Markdown
Contributor

Fixes: #94.

@kad-hollac1

Copy link
Copy Markdown
Contributor Author

Requires #88.

@acch acch added the waiting-response Waiting for response from one of the maintainer label Feb 20, 2026
@kad-hollac1
kad-hollac1 force-pushed the feat/team-membership branch 2 times, most recently from d881e92 to 53a6408 Compare February 20, 2026 14:47
@kad-hollac1
kad-hollac1 marked this pull request as ready for review February 20, 2026 14:48
@kad-hollac1
kad-hollac1 requested a review from acch as a code owner February 20, 2026 14:48
@acch

acch commented Feb 20, 2026

Copy link
Copy Markdown
Member

Hi @kad-hollac1 - thank you very much for this PR!

I had made some changes to your previous contribution, in order to make the forgejo_team resource implementation more consistent with the established patterns in the other resources. Please check out 6af6ee0, specifically regarding error handling and wording of error messages. I know I'm picky, but I'd like to keep those as homogeneous as possible across all resources.

Also, your tests seem to be failing...

@github-actions github-actions Bot removed the waiting-response Waiting for response from one of the maintainer label Feb 20, 2026
@kad-hollac1
kad-hollac1 force-pushed the feat/team-membership branch 5 times, most recently from 96a8e2e to 7c25a0c Compare February 20, 2026 20:10
@kad-hollac1

Copy link
Copy Markdown
Contributor Author

Thanks I've changed some, I hope it is good enough now, let me know otherwise. Sorry I pushed the ,,request review'' button too soon. ^^

@acch acch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks much for this @kad-hollac1! I do have three requests, though:

  1. Let's call the resource and data source forgejo_team_member. This is more consistent with the other resources, such as forgejo_collaborator.

  2. Let's reference users by their name instead of their ID. As users are frequently created outside of Terraform, referencing them by their name is more convenient. You can refer to the forgejo_collaborator schema for an example.

  3. Could you please add usage examples for forgejo_team and forgejo_team_member to the examples/ folder? These are included in the documentation when markdown is rendered.

Comment thread internal/provider/team_member_data_source.go Outdated
Comment thread internal/provider/team_membership_data_source.go Outdated
Comment thread internal/provider/team_membership_data_source.go Outdated
Comment thread internal/provider/team_membership_resource.go Outdated
Comment thread internal/provider/team_member_resource.go Outdated
Comment thread internal/provider/team_membership_resource.go Outdated
Comment thread internal/provider/team_membership_data_source.go Outdated
@kad-hollac1

Copy link
Copy Markdown
Contributor Author
2. Let's reference users by their name instead of their ID. As users are frequently created outside of Terraform, referencing them by their name is more convenient. You can refer to the `forgejo_collaborator` schema for an example.

Funnily enough, we'll be using it mainly for bot-users that our developers create themselves. ;) I'd actually say we should still reference by ID, for consistency, and let practitioners use a data indirection to reference them by name (cf. c59f532).

@kad-hollac1
kad-hollac1 force-pushed the feat/team-membership branch 2 times, most recently from b49c469 to df83b39 Compare February 23, 2026 08:10
@kad-hollac1
kad-hollac1 requested a review from acch February 23, 2026 08:13
@kad-hollac1
kad-hollac1 force-pushed the feat/team-membership branch 3 times, most recently from d4eb80c to d2952fd Compare February 23, 2026 08:33
@acch

acch commented Mar 1, 2026

Copy link
Copy Markdown
Member

Thanks much for these changes @kad-hollac1, the code looks very well now!

However, the current convention is to reference organisations and repositories by their ID, and users by their name (for the reasons stated). In order to keep this consistent across the provider, we would either need to change all resources and data sources to reference users by ID (forgejo_collaborator, forgejo_gpg_key, forgejo_repository, forgejo_ssh_key), or change forgejo_team_member to reference users by their name...

@kad-hollac1

Copy link
Copy Markdown
Contributor Author

Sorry, I totally missed that the convention for users is different than for other entities. It is your call. If you actually want the former, I can create a separate patch for using IDs in other resources. Else I'll update this to use usernames.

@acch

acch commented Mar 2, 2026

Copy link
Copy Markdown
Member

Thanks @kad-hollac1. I'd prefer to go with the current convention and update this resource and data source to use the user's name. The other alternative would be a major breaking change, which I'd like to avoid...

Thanks much for your continued efforts!

@kad-hollac1
kad-hollac1 force-pushed the feat/team-membership branch from d2952fd to da6502a Compare March 3, 2026 04:50
@kad-hollac1
kad-hollac1 force-pushed the feat/team-membership branch from da6502a to 5491aff Compare March 3, 2026 04:57
@kad-hollac1

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, @acch. I've updated this merge request to use usernames.

@acch

acch commented Mar 7, 2026

Copy link
Copy Markdown
Member

Thanks much for this @kad-hollac1! The code looks great, merging it now...

@acch
acch merged commit 7c12e1b into svalabs:main Mar 7, 2026
5 checks passed
@kad-hollac1
kad-hollac1 deleted the feat/team-membership branch March 9, 2026 08:22
@kad-hollac1

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge! :)

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for org memberships

2 participants