-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: airghy <[email protected]>
Signed-off-by: airghy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, I left a few comments.
Let me know what you think. The idea in cdevents/webhook-adapter#2 is to create a plugin for the existing webhook adapter, not to create a new one. You could use the existing gerrit plugin as a starting point: https://github.com/cdevents/gerrit-translator/
### 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not seen the distinction github-event
vs issue-event
before. Do you have a link to the relevant GitHub docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Her is the link of issue event https://docs.github.com/en/rest/using-the-rest-api/issue-event-types?apiVersion=2022-11-28
We have a [public project](https://github.com/rjtch/nodejs-webhook-server) on our github-account that is a simple nodejs-server capable to receive webhook-event (But any other server can be used for this end). | ||
As webhook server we use [Hookdeck](https://hookdeck.com/webhooks/platforms/tutorial-github-webhooks). After everything is well configured we can start the webhook server together with our node-js-server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this was about cdevents/webhook-adapter#2.
We should create a plugin for the webhook adapter.
|
||
| CDEvent Type | Webhook/Github Event Type | Comments | | ||
|:---------------------------------|:----------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| dev.cdevents.repository.forked | fork | A user forks a repository. (should be defined in the spec) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use the repository.created
event here. There is no repository.forked
event in CDEvents and I'm not sure we should add one as it's a very GitHub specific thing.
We could have add a reference to a source or template repo in the repository.created
event if that helps.
| CDEvent Type | Webhook/Github Event Type | Comments | | ||
|:---------------------------------|:----------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| dev.cdevents.repository.forked | fork | A user forks a repository. (should be defined in the spec) | | ||
| dev.cdevents.repository.imported | repository_import | when a new repository is imported to Github. (should be defined in the spec) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could use repository.created
here too.
I had never even heard of a repository import functionality before 😅
|:---------------------------------|:----------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| dev.cdevents.repository.forked | fork | A user forks a repository. (should be defined in the spec) | | ||
| dev.cdevents.repository.imported | repository_import | when a new repository is imported to Github. (should be defined in the spec) | | ||
| dev.cdevents.repository.* | repository | This event occurs when there is activity relating to repositories. <details><summary>Actions</summary> {"Action type":{"created", "modified", "deleted", "edited", "privatized", "publicized", "renamed", "transfered", "unarchived", "archived"}</br> | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should map these to CDEvents that exist where possible:
created
: created
modified
, edited
, privatized
, publicized
: modified
deleted
: deleted
renamed
could be a flavour modified
as well, but it could be considered as a deleted
+ created
as well.
transferred
poses similar questions too, we don't have a concept of org
in CDEvents (yet), so it would be similar to a rename
I think.
unarchived
, archived
are probably flavours of modified
too.
| dev.cdevents.change.* | 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", "edited", "enqueued", <br/>"archived", "labeled", "locked", "milestoned", "opened", "ready_for_review","reopened", "review_request_removed", "review_requested", "synchronized", "unassigned", "unlabeled", "unlocked"}</br> | | ||
| dev.cdevents.change.* | 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"} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to map as much as possible events from GitHub to events that exist in CDEvents.
This RFC describes
an approach to integrate Jira with CDEvents using using webhook-adapter.
and the list of Github-Webhook event types mapping with CDEvents.
This RFC is related to this task cd-event-github-plugin