This topic describes how to use an HTTP event source to integrate GitHub with EventBridge.
Background information
GitHub is a version management tool. For a project that has multiple developers, you can use EventBridge to notify the developers of specific operations that are performed in the GitHub code repository of the project. This allows the developers to effectively follow the code changes and improves the collaboration efficiency.
Prerequisites
EventBridge is activated and the required permissions are granted to a RAM user. For more information, see Activate EventBridge and grant permissions to a RAM user.
A custom event bus is created. For more information, see Create a custom event bus
A GitHub account is registered. For more information, visit the official website of GitHub.
Procedure
Step 1: Create an event source for GitHub in EventBridge
Create an event source HTTP/HTTPS trigger in the EventBridge console. The following table describes the parameters. For more information, see Create a custom event source of the HTTP/HTTPS Events type.
Request Type: Select HTTP&HTTPS.
Request Method: Select a POST.
Security Configuration: Select Optional.
After the event source is created, you can find the custom event source in the event source list, and then click Details to view the configuration information. Internet request URL can be used as the webhook URL of the event source.
Step 2: Configure a webhook in GitHub
Log on to GitHub and click a repository.
Click the Settings tab. In the left-side navigation pane, click Webhooks.
In the upper-right corner of the page that appears, click Add webhook, configure the parameters, and then click Add webhook. The following items describe the parameters:
Payload URL: Enter the Internet request URL that is generated in Step 1: Create an event source for GitHub in EventBridge.
Content type: Select application/json.
Which events would you like to trigger this webhook?: Select Just the push event.
Perform operations in the local repository and push the changes to GitHub.
Step 3: Verify the result
- Log on to the EventBridge console.
- In the top navigation bar, select the region.
- In the left-side navigation pane, click Event Buses.
In the left-side navigation pane, click Event Tracking to view and verify the obtained event information.