Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 1569708

Browse files
authored
Creates the Github Source Documentation (#159)
1 parent 49b41e5 commit 1569708

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed
59.2 KB
Loading
20.3 KB
Loading

docs/sources/github.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Event Source for Github
2+
3+
This event source creates a webhook to listen for incoming Github Events, turning received requests into [CloudEvents][ce] to be consumed by other TriggerMesh components.
4+
5+
## Prerequisite(s)
6+
7+
- GitHub Tokens
8+
9+
### Create GitHub Tokens
10+
Create a personal access token for GitHub that the GitHub source can use to register webhooks with the GitHub API. Also decide on a secret token that your code will use to authenticate the incoming webhooks from GitHub (secretToken).
11+
12+
The token can be named anything you find convenient. The Source requires `repo:public_repo` and `admin:repo_hook`, to let it fire events from your public repositories and to create webhooks for those repositories. Copy and save this token; GitHub will force you to generate it again if misplaced.
13+
14+
Here's an example for a token named "GitHubSource Sample" with the recommended scopes:
15+
16+
![ght](../images/github/personal_access_token.png)
17+
18+
## Deploying an Instance of the Source
19+
20+
Open the Bridge creation screen and add a source of type `Github`.
21+
22+
In the Source creation form, give a name to the event source and add the following information:
23+
24+
- **Secret**: Reference to a [TriggerMesh secret][tm-secret] containing an Access Token and Secret Token, as described in the previous sections.
25+
- **Name**: all TriggerMesh components need a unique name per namespace.
26+
- **Broker**: request converted into [CloudEvents][ce] will be sent to this location.
27+
- **Repository owner and Name**: A valid GitHub public repository owned by your GitHub user. (eg. <YOUR USER>/<YOUR REPO>).
28+
- **Event Types**: Select from the dropdown the types of events the source should emit.
29+
30+
After clicking the `Save` button, you will be taken back to the Bridge editor. Proceed by adding the remaining components to the Bridge, then submit it.
31+
32+
A ready status on the main _Bridges_ page indicates that the event source is ready to receive notifications from the Github Event Source.
33+
34+
![Bridge status](../images/bridge-status-green.png)
35+
### Verify
36+
37+
Verify the GitHub webhook was created by looking at the list of webhooks under the Settings tab in your GitHub repository. A hook should be listed that points to your Knative cluster with a green check mark to the left of the hook URL, as shown below.
38+
39+
![wh](../images/github/webhook_created.png)
40+
41+
### More Information
42+
More information on the Github Event Source can be found here: https://knative.dev/docs/eventing/samples/github-source/
43+
44+
## Event Types
45+
46+
The Github event source emits events that begin with `dev.knative.source.github.` and end in the event type. For example: `dev.knative.source.github.pull_request`, `dev.knative.source.github.create`, and `dev.knative.source.github.delete`.
47+
48+
[tm-secret]: ../guides/secrets.md
49+
[ce]: https://cloudevents.io

docs/sources/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ solutions on our Cloud.
1616
- [AWS S3](./awss3.md): Subscribe to event notifications from an Amazon S3 bucket.
1717
- [AWS SNS](./awssns.md): Subscribe to messages from a AWS SNS topic.
1818
- [AWS SQS](./awssqs.md): Capture messages from an AWS SQS queue.
19+
- [Github](./github.md): Consume Github events as Cloudevents
1920
- Google Cloud
2021
- [Google Cloud Pub/Sub](./googlecloudpubsub.md): Receive messages from a Google Cloud Pub/Sub topic.
2122
- [Google Cloud Storage](./googlecloudstorage.md): Capture change notifications from a Google Cloud Storage bucket.

0 commit comments

Comments
 (0)