1. Packages
  2. Github Provider
  3. API Docs
  4. RepositoryWebhook
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

github.RepositoryWebhook

Explore with Pulumi AI

This resource allows you to create and manage webhooks for repositories within your GitHub organization or personal account.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const repo = new github.Repository("repo", {
    name: "foo",
    description: "Terraform acceptance tests",
    homepageUrl: "http://example.com/",
    visibility: "public",
});
const foo = new github.RepositoryWebhook("foo", {
    repository: repo.name,
    configuration: {
        url: "https://google.de/",
        contentType: "form",
        insecureSsl: false,
    },
    active: false,
    events: ["issues"],
});
Copy
import pulumi
import pulumi_github as github

repo = github.Repository("repo",
    name="foo",
    description="Terraform acceptance tests",
    homepage_url="http://example.com/",
    visibility="public")
foo = github.RepositoryWebhook("foo",
    repository=repo.name,
    configuration={
        "url": "https://google.de/",
        "content_type": "form",
        "insecure_ssl": False,
    },
    active=False,
    events=["issues"])
Copy
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 {
		repo, err := github.NewRepository(ctx, "repo", &github.RepositoryArgs{
			Name:        pulumi.String("foo"),
			Description: pulumi.String("Terraform acceptance tests"),
			HomepageUrl: pulumi.String("http://example.com/"),
			Visibility:  pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		_, err = github.NewRepositoryWebhook(ctx, "foo", &github.RepositoryWebhookArgs{
			Repository: repo.Name,
			Configuration: &github.RepositoryWebhookConfigurationArgs{
				Url:         pulumi.String("https://google.de/"),
				ContentType: pulumi.String("form"),
				InsecureSsl: pulumi.Bool(false),
			},
			Active: pulumi.Bool(false),
			Events: pulumi.StringArray{
				pulumi.String("issues"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;

return await Deployment.RunAsync(() => 
{
    var repo = new Github.Repository("repo", new()
    {
        Name = "foo",
        Description = "Terraform acceptance tests",
        HomepageUrl = "http://example.com/",
        Visibility = "public",
    });

    var foo = new Github.RepositoryWebhook("foo", new()
    {
        Repository = repo.Name,
        Configuration = new Github.Inputs.RepositoryWebhookConfigurationArgs
        {
            Url = "https://google.de/",
            ContentType = "form",
            InsecureSsl = false,
        },
        Active = false,
        Events = new[]
        {
            "issues",
        },
    });

});
Copy
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.RepositoryWebhook;
import com.pulumi.github.RepositoryWebhookArgs;
import com.pulumi.github.inputs.RepositoryWebhookConfigurationArgs;
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 repo = new Repository("repo", RepositoryArgs.builder()
            .name("foo")
            .description("Terraform acceptance tests")
            .homepageUrl("http://example.com/")
            .visibility("public")
            .build());

        var foo = new RepositoryWebhook("foo", RepositoryWebhookArgs.builder()
            .repository(repo.name())
            .configuration(RepositoryWebhookConfigurationArgs.builder()
                .url("https://google.de/")
                .contentType("form")
                .insecureSsl(false)
                .build())
            .active(false)
            .events("issues")
            .build());

    }
}
Copy
resources:
  repo:
    type: github:Repository
    properties:
      name: foo
      description: Terraform acceptance tests
      homepageUrl: http://example.com/
      visibility: public
  foo:
    type: github:RepositoryWebhook
    properties:
      repository: ${repo.name}
      configuration:
        url: https://google.de/
        contentType: form
        insecureSsl: false
      active: false
      events:
        - issues
Copy

Create RepositoryWebhook Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RepositoryWebhook(name: string, args: RepositoryWebhookArgs, opts?: CustomResourceOptions);
@overload
def RepositoryWebhook(resource_name: str,
                      args: RepositoryWebhookArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def RepositoryWebhook(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      events: Optional[Sequence[str]] = None,
                      repository: Optional[str] = None,
                      active: Optional[bool] = None,
                      configuration: Optional[RepositoryWebhookConfigurationArgs] = None)
func NewRepositoryWebhook(ctx *Context, name string, args RepositoryWebhookArgs, opts ...ResourceOption) (*RepositoryWebhook, error)
public RepositoryWebhook(string name, RepositoryWebhookArgs args, CustomResourceOptions? opts = null)
public RepositoryWebhook(String name, RepositoryWebhookArgs args)
public RepositoryWebhook(String name, RepositoryWebhookArgs args, CustomResourceOptions options)
type: github:RepositoryWebhook
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RepositoryWebhookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RepositoryWebhookArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryWebhookArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryWebhookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RepositoryWebhookArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var repositoryWebhookResource = new Github.RepositoryWebhook("repositoryWebhookResource", new()
{
    Events = new[]
    {
        "string",
    },
    Repository = "string",
    Active = false,
    Configuration = new Github.Inputs.RepositoryWebhookConfigurationArgs
    {
        Url = "string",
        ContentType = "string",
        InsecureSsl = false,
        Secret = "string",
    },
});
Copy
example, err := github.NewRepositoryWebhook(ctx, "repositoryWebhookResource", &github.RepositoryWebhookArgs{
	Events: pulumi.StringArray{
		pulumi.String("string"),
	},
	Repository: pulumi.String("string"),
	Active:     pulumi.Bool(false),
	Configuration: &github.RepositoryWebhookConfigurationArgs{
		Url:         pulumi.String("string"),
		ContentType: pulumi.String("string"),
		InsecureSsl: pulumi.Bool(false),
		Secret:      pulumi.String("string"),
	},
})
Copy
var repositoryWebhookResource = new RepositoryWebhook("repositoryWebhookResource", RepositoryWebhookArgs.builder()
    .events("string")
    .repository("string")
    .active(false)
    .configuration(RepositoryWebhookConfigurationArgs.builder()
        .url("string")
        .contentType("string")
        .insecureSsl(false)
        .secret("string")
        .build())
    .build());
Copy
repository_webhook_resource = github.RepositoryWebhook("repositoryWebhookResource",
    events=["string"],
    repository="string",
    active=False,
    configuration={
        "url": "string",
        "content_type": "string",
        "insecure_ssl": False,
        "secret": "string",
    })
Copy
const repositoryWebhookResource = new github.RepositoryWebhook("repositoryWebhookResource", {
    events: ["string"],
    repository: "string",
    active: false,
    configuration: {
        url: "string",
        contentType: "string",
        insecureSsl: false,
        secret: "string",
    },
});
Copy
type: github:RepositoryWebhook
properties:
    active: false
    configuration:
        contentType: string
        insecureSsl: false
        secret: string
        url: string
    events:
        - string
    repository: string
Copy

RepositoryWebhook Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RepositoryWebhook resource accepts the following input properties:

Events This property is required. List<string>
A list of events which should trigger the webhook. See a list of available events.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The repository of the webhook.
Active bool
Indicate if the webhook should receive events. Defaults to true.
Configuration RepositoryWebhookConfiguration
Configuration block for the webhook. Detailed below.
Events This property is required. []string
A list of events which should trigger the webhook. See a list of available events.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The repository of the webhook.
Active bool
Indicate if the webhook should receive events. Defaults to true.
Configuration RepositoryWebhookConfigurationArgs
Configuration block for the webhook. Detailed below.
events This property is required. List<String>
A list of events which should trigger the webhook. See a list of available events.
repository
This property is required.
Changes to this property will trigger replacement.
String
The repository of the webhook.
active Boolean
Indicate if the webhook should receive events. Defaults to true.
configuration RepositoryWebhookConfiguration
Configuration block for the webhook. Detailed below.
events This property is required. string[]
A list of events which should trigger the webhook. See a list of available events.
repository
This property is required.
Changes to this property will trigger replacement.
string
The repository of the webhook.
active boolean
Indicate if the webhook should receive events. Defaults to true.
configuration RepositoryWebhookConfiguration
Configuration block for the webhook. Detailed below.
events This property is required. Sequence[str]
A list of events which should trigger the webhook. See a list of available events.
repository
This property is required.
Changes to this property will trigger replacement.
str
The repository of the webhook.
active bool
Indicate if the webhook should receive events. Defaults to true.
configuration RepositoryWebhookConfigurationArgs
Configuration block for the webhook. Detailed below.
events This property is required. List<String>
A list of events which should trigger the webhook. See a list of available events.
repository
This property is required.
Changes to this property will trigger replacement.
String
The repository of the webhook.
active Boolean
Indicate if the webhook should receive events. Defaults to true.
configuration Property Map
Configuration block for the webhook. Detailed below.

Outputs

All input properties are implicitly available as output properties. Additionally, the RepositoryWebhook resource produces the following output properties:

Etag string
Id string
The provider-assigned unique ID for this managed resource.
Url string
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
Etag string
Id string
The provider-assigned unique ID for this managed resource.
Url string
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
etag String
id String
The provider-assigned unique ID for this managed resource.
url String
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
etag string
id string
The provider-assigned unique ID for this managed resource.
url string
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
etag str
id str
The provider-assigned unique ID for this managed resource.
url str
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
etag String
id String
The provider-assigned unique ID for this managed resource.
url String
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.

Look up Existing RepositoryWebhook Resource

Get an existing RepositoryWebhook resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RepositoryWebhookState, opts?: CustomResourceOptions): RepositoryWebhook
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        active: Optional[bool] = None,
        configuration: Optional[RepositoryWebhookConfigurationArgs] = None,
        etag: Optional[str] = None,
        events: Optional[Sequence[str]] = None,
        repository: Optional[str] = None,
        url: Optional[str] = None) -> RepositoryWebhook
func GetRepositoryWebhook(ctx *Context, name string, id IDInput, state *RepositoryWebhookState, opts ...ResourceOption) (*RepositoryWebhook, error)
public static RepositoryWebhook Get(string name, Input<string> id, RepositoryWebhookState? state, CustomResourceOptions? opts = null)
public static RepositoryWebhook get(String name, Output<String> id, RepositoryWebhookState state, CustomResourceOptions options)
resources:  _:    type: github:RepositoryWebhook    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Active bool
Indicate if the webhook should receive events. Defaults to true.
Configuration RepositoryWebhookConfiguration
Configuration block for the webhook. Detailed below.
Etag string
Events List<string>
A list of events which should trigger the webhook. See a list of available events.
Repository Changes to this property will trigger replacement. string
The repository of the webhook.
Url string
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
Active bool
Indicate if the webhook should receive events. Defaults to true.
Configuration RepositoryWebhookConfigurationArgs
Configuration block for the webhook. Detailed below.
Etag string
Events []string
A list of events which should trigger the webhook. See a list of available events.
Repository Changes to this property will trigger replacement. string
The repository of the webhook.
Url string
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
active Boolean
Indicate if the webhook should receive events. Defaults to true.
configuration RepositoryWebhookConfiguration
Configuration block for the webhook. Detailed below.
etag String
events List<String>
A list of events which should trigger the webhook. See a list of available events.
repository Changes to this property will trigger replacement. String
The repository of the webhook.
url String
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
active boolean
Indicate if the webhook should receive events. Defaults to true.
configuration RepositoryWebhookConfiguration
Configuration block for the webhook. Detailed below.
etag string
events string[]
A list of events which should trigger the webhook. See a list of available events.
repository Changes to this property will trigger replacement. string
The repository of the webhook.
url string
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
active bool
Indicate if the webhook should receive events. Defaults to true.
configuration RepositoryWebhookConfigurationArgs
Configuration block for the webhook. Detailed below.
etag str
events Sequence[str]
A list of events which should trigger the webhook. See a list of available events.
repository Changes to this property will trigger replacement. str
The repository of the webhook.
url str
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
active Boolean
Indicate if the webhook should receive events. Defaults to true.
configuration Property Map
Configuration block for the webhook. Detailed below.
etag String
events List<String>
A list of events which should trigger the webhook. See a list of available events.
repository Changes to this property will trigger replacement. String
The repository of the webhook.
url String
URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.

Supporting Types

RepositoryWebhookConfiguration
, RepositoryWebhookConfigurationArgs

Url This property is required. string
The URL of the webhook.
ContentType string
The content type for the payload. Valid values are either form or json.
InsecureSsl bool
Insecure SSL boolean toggle. Defaults to false.
Secret string
The shared secret for the webhook. See API documentation.
Url This property is required. string
The URL of the webhook.
ContentType string
The content type for the payload. Valid values are either form or json.
InsecureSsl bool
Insecure SSL boolean toggle. Defaults to false.
Secret string
The shared secret for the webhook. See API documentation.
url This property is required. String
The URL of the webhook.
contentType String
The content type for the payload. Valid values are either form or json.
insecureSsl Boolean
Insecure SSL boolean toggle. Defaults to false.
secret String
The shared secret for the webhook. See API documentation.
url This property is required. string
The URL of the webhook.
contentType string
The content type for the payload. Valid values are either form or json.
insecureSsl boolean
Insecure SSL boolean toggle. Defaults to false.
secret string
The shared secret for the webhook. See API documentation.
url This property is required. str
The URL of the webhook.
content_type str
The content type for the payload. Valid values are either form or json.
insecure_ssl bool
Insecure SSL boolean toggle. Defaults to false.
secret str
The shared secret for the webhook. See API documentation.
url This property is required. String
The URL of the webhook.
contentType String
The content type for the payload. Valid values are either form or json.
insecureSsl Boolean
Insecure SSL boolean toggle. Defaults to false.
secret String
The shared secret for the webhook. See API documentation.

Import

Repository webhooks can be imported using the name of the repository, combined with the id of the webhook, separated by a / character. The id of the webhook can be found in the URL of the webhook. For example: "https://github.com/foo-org/foo-repo/settings/hooks/14711452".

Importing uses the name of the repository, as well as the ID of the webhook, e.g.

$ pulumi import github:index/repositoryWebhook:RepositoryWebhook terraform terraform/11235813
Copy

If secret is populated in the webhook’s configuration, the value will be imported as “********”.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
GitHub pulumi/pulumi-github
License
Apache-2.0
Notes
This Pulumi package is based on the github Terraform Provider.