Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Github-CDEvents Integration #47

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions rfc/github-cdevents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Github-CDEvents Integration

### Overview
The integration of CDEvents with Github is made by converting Github events into CDEvents. This effort uses Github Webhook generated events and translate them into CDEvents.

Github utilizes two types of events: the github-event and the issue-event. These events are to be converted into [CDEvents-Source Code Control Events](https://github.com/cdevents/spec/blob/v0.3.0/source-code-version-control.md)
rjtch marked this conversation as resolved.
Show resolved Hide resolved
using a custom github-event to CDEvent translator.

#### Create a repository webhook
In order to configure the webhook properly a repository should be created and configured. [Link](https://docs.github.com/en/webhooks/using-webhooks/creating-webhooks#creating-a-repository-webhook)

### CDEvent github-webhook-tranlator

A new REST endpoint `/github-events` will be implemented to receive all github-events and translate them to CDEvents.
rjtch marked this conversation as resolved.
Show resolved Hide resolved
The below list of [CDEvents-Source Code Control Events](https://github.com/cdevents/spec/blob/v0.3.0/source-code-version-control.md) will be mapped with corresponding Github-Webhook event types to translate.
Since this effort is to process [webhook events](https://docs.github.com/en/webhooks/webhook-events-and-payloads), we consider processing the webhook-events
related to branch, repository, deployment and artifact. The [CDEvent-Spec](https://github.com/cdevents/spec/blob/v0.3.0/spec.md) does not have events for tags or release yet.
rjtch marked this conversation as resolved.
Show resolved Hide resolved


| CDEvent Type | Webhook/Github Event Type | Comments |
|:--------------------------------|:----------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| dev.cdevents.repository.created | push | A Git repository has been created from a template. |
| dev.cdevents.branch.deleted | delete | A Git branch or tag is deleted | | |
| dev.cdevents.branch.created | create | A Git branch or tag is created. |
| dev.cdevents.branch.deleted | push | A Git branch has been deleted. But to subscribe to only branch and tag deletions, use the delete webhook event. |
| dev.cdevents.change.updated | push | A commit/ commit tag is pushed. |
rjtch marked this conversation as resolved.
Show resolved Hide resolved
| dev.cdevents.change.created | pull_request | This event occurs when there is activity on a pull request. <details><summary>Actions</summary> {"Action type":{"opened"}</br> |
| dev.cdevents.change.updated | pull_request | This event occurs when there is activity on a pull request. <details><summary>Actions</summary> {"Action type":{"assigned", "auto_merge_disabled", "auto_merge_enabled", "closed", "converted_to_draft", "demilestoned", "dequeued", "enqueued", <br/>"archived", "labeled", "locked", "milestoned", "ready_for_review","reopened", "review_request_removed", "review_requested", "synchronized", "unassigned", "unlabeled", "unlocked"}</br> |
| dev.cdevents.change.reviewed | pull_request_review_comment | This event occurs when there is activity on a pull request review comment. <details><summary>Actions</summary> {"Action type":{"created", "reviewed", "commented"} |
| dev.cdevents.change.reviewed | pull_request_review | This event occurs when there is activity relating to a pull request review. <details><summary>Actions</summary> {"Action type":{"edited", "dismissed", "submitted"} </details> |
| dev.cdevents.change.modified | pull_request_review_thread | This event occurs when there is activity relating to a comment thread on a pull request. <details><summary>Actions</summary> {"Action type":{"resolved", "unresolved"} </details> |
rjtch marked this conversation as resolved.
Show resolved Hide resolved
| dev.cdevents.artifact.modified | package/registry_package | This event occurs when there is activity relating to GitHub Packages/registry. <details><summary>Actions</summary> {"Action type":{"published", "updated"} </details> |
rjtch marked this conversation as resolved.
Show resolved Hide resolved

Once mapped the CDEvent will be created using CDEvents SDK(Java/Go) and send to the configured `Events Broker URL`
rjtch marked this conversation as resolved.
Show resolved Hide resolved