Skip to content

feat: add org invite resource#3229

Open
Gowiem wants to merge 1 commit intointegrations:mainfrom
Gowiem:feat/organization-invitation
Open

feat: add org invite resource#3229
Gowiem wants to merge 1 commit intointegrations:mainfrom
Gowiem:feat/organization-invitation

Conversation

@Gowiem
Copy link

@Gowiem Gowiem commented Feb 26, 2026

Resolves #2197

This is in response to @deiga's request.

Fair warning: This was mostly letting Claude Code rip on that issue thread. I did however test that this works in a local project and using the resource with an email did show me 2 validation errors (no seats + user already in org) and then with a new email, it was able to add that user and I was able to get an invite email to that user's email address.

Happy to address any feedback!


Before the change?

There was no means by which to invite a user to the organization via email. You had to invite them via their github handle.

After the change?

You can now invite users to the organization via an email.

Pull request checklist

  • Schema migrations have been created if needed (example)
    • Not sure on this one, but I don't imagine migrations are needed.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-actions
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@github-actions github-actions bot added the Type: Feature New feature or request label Feb 26, 2026
Comment on lines +90 to +92
if err = d.Set("invitation_id", int(invitationID)); err != nil {
return diag.FromErr(err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems superfluous, since we are setting the same as the resource ID alrady

return diag.FromErr(err)
}

ctx = context.WithValue(ctx, ctxId, d.Id())
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't needed

Suggested change
ctx = context.WithValue(ctx, ctxId, d.Id())

Comment on lines +142 to +149
if invitation == nil {
// Invitation was accepted, cancelled, or expired — remove from state
tflog.Info(ctx, fmt.Sprintf("Removing organization invitation %s from state because it is no longer pending", d.Id()), map[string]any{
"invitation_id": d.Id(),
})
d.SetId("")
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems problematic as this breaks idempotency. The resource would automatically be removed and next plan would try to re-add it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: github_membership invite using the email address

2 participants