User Invitation Accepter Args
data class UserInvitationAccepterArgs(val allowEmptyId: Output<Boolean>? = null, val invitationId: Output<String>? = null) : ConvertibleToJava<UserInvitationAccepterArgs>
Provides a resource to manage GitHub repository collaborator invitations.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = new github.Repository("example", {name: "example-repo"});
const exampleRepositoryCollaborator = new github.RepositoryCollaborator("example", {
repository: example.name,
username: "example-username",
permission: "push",
});
const exampleUserInvitationAccepter = new github.UserInvitationAccepter("example", {invitationId: exampleRepositoryCollaborator.invitationId});
Content copied to clipboard
import pulumi
import pulumi_github as github
example = github.Repository("example", name="example-repo")
example_repository_collaborator = github.RepositoryCollaborator("example",
repository=example.name,
username="example-username",
permission="push")
example_user_invitation_accepter = github.UserInvitationAccepter("example", invitation_id=example_repository_collaborator.invitation_id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = new Github.Repository("example", new()
{
Name = "example-repo",
});
var exampleRepositoryCollaborator = new Github.RepositoryCollaborator("example", new()
{
Repository = example.Name,
Username = "example-username",
Permission = "push",
});
var exampleUserInvitationAccepter = new Github.UserInvitationAccepter("example", new()
{
InvitationId = exampleRepositoryCollaborator.InvitationId,
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := github.NewRepository(ctx, "example", &github.RepositoryArgs{
Name: pulumi.String("example-repo"),
})
if err != nil {
return err
}
exampleRepositoryCollaborator, err := github.NewRepositoryCollaborator(ctx, "example", &github.RepositoryCollaboratorArgs{
Repository: example.Name,
Username: pulumi.String("example-username"),
Permission: pulumi.String("push"),
})
if err != nil {
return err
}
_, err = github.NewUserInvitationAccepter(ctx, "example", &github.UserInvitationAccepterArgs{
InvitationId: exampleRepositoryCollaborator.InvitationId,
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.RepositoryCollaborator;
import com.pulumi.github.RepositoryCollaboratorArgs;
import com.pulumi.github.UserInvitationAccepter;
import com.pulumi.github.UserInvitationAccepterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Repository("example", RepositoryArgs.builder()
.name("example-repo")
.build());
var exampleRepositoryCollaborator = new RepositoryCollaborator("exampleRepositoryCollaborator", RepositoryCollaboratorArgs.builder()
.repository(example.name())
.username("example-username")
.permission("push")
.build());
var exampleUserInvitationAccepter = new UserInvitationAccepter("exampleUserInvitationAccepter", UserInvitationAccepterArgs.builder()
.invitationId(exampleRepositoryCollaborator.invitationId())
.build());
}
}
Content copied to clipboard
resources:
example:
type: github:Repository
properties:
name: example-repo
exampleRepositoryCollaborator:
type: github:RepositoryCollaborator
name: example
properties:
repository: ${example.name}
username: example-username
permission: push
exampleUserInvitationAccepter:
type: github:UserInvitationAccepter
name: example
properties:
invitationId: ${exampleRepositoryCollaborator.invitationId}
Content copied to clipboard
Allowing empty invitation IDs
Set allow_empty_id
when using for_each
over a list of github_repository_collaborator.invitation_id
's. This allows applying a module again when a new github.RepositoryCollaborator
resource is added to the for_each
loop. This is needed as the github_repository_collaborator.invitation_id
will be empty after a state refresh when the invitation has been accepted. Note that when an invitation is accepted manually or by another tool between a state refresh and a pulumi up
using that refreshed state, the plan will contain the invitation ID, but the apply will receive an HTTP 404 from the API since the invitation has already been accepted. This is tracked in #1157.