Giter Site home page Giter Site logo

source-github's Introduction

GitHub Source

Overview

A Vance Connector which retrieves GitHub webhooks events, transform them into CloudEvents and deliver CloudEvents to the target URL.

User Guidelines

Connector Introduction

The GitHub Source is a Vance Connector designed to retrieves GitHub webhooks events in various format, transform them into CloudEvents based on CloudEvents Adapter specification and wrap the body of the original request into the data of CloudEvents.

The original GitHub webhooks events look like:

{
  "action": "created",
  "starred_at": "2022-07-21T06:28:23Z",
  "repository": {
    "id": 513353059,
    "node_id": "R_kgDOHpklYw",
    "name": "test-repo",
    "full_name": "XXXX/test-repo",
    "private": false,
    "owner": {
      "login": "XXXX",
      "type": "User",
      "site_admin": false
    },
    "visibility": "public",
    "forks": 0,
    "open_issues": 2,
    "watchers": 1,
    "default_branch": "main"
  },
  "sender": {
    "login": "XXXX",
    "id": 75800782,
    "node_id": "MDQ6VXNlcjc1ODAwNzgy",
    "avatar_url": "https://avatars.githubusercontent.com/u/75800782?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/XXXX",
    "html_url": "https://github.com/XXXX",
    "followers_url": "https://api.github.com/users/XXXX/followers",
    "following_url": "https://api.github.com/users/XXXX/following{/other_user}",
    "gists_url": "https://api.github.com/users/XXXX/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/XXXX/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/XXXX/subscriptions",
    "organizations_url": "https://api.github.com/users/XXXX/orgs",
    "repos_url": "https://api.github.com/users/XXXX/repos",
    "events_url": "https://api.github.com/users/XXXX/events{/privacy}",
    "received_events_url": "https://api.github.com/users/XXXX/received_events",
    "type": "User",
    "site_admin": false
  }
}

This GitHub star event will be transformed into a CloudEvents like:

CloudEvent:{
	id:"4ef226c0-08c7-11ed-998d-93772adf8abb", 
	source:"https://api.github.com/repos/XXXX/test-repo", 
	type:"com.github.watch.started", 
	datacontenttype:"application/json", 
	time:"2022-07-21T07:32:44.190Z", 
	data:JsonCloudEventData{
		"http request body"
	}
}

GitHub Source Configs

Users can specify their configs by either setting environments variables or mount a config.json to /vance/config/config.json when they run the connector. Find examples of setting configs here.

Config Fields of the GitHub Source

Configs Description Example Required
v_target v_target is used to specify the target URL HTTP Source will send CloudEvents to "http://localhost:8081" YES
v_port v_port is used to specify the port HTTP Source is listening on "8080" YES

GitHub Source Secrets

Users should set their sensitive data Base64 encoded in a secret file. And mount your local secret file to /vance/secret/secret.json when you run the connector.

Encode your sensitive data

$ echo -n ABCDEFG | base64
QUJDREVGRw==

Replace 'ABCDEFG' with your sensitive data.

Set your local secret file

$ cat secret.json
{
  "githubWebHookSecret": "${githubWebHookSecret}"
}
Secrets Description Example Required
githubWebHookSecret The githubWebHookSecret is used to verify your webhook secret key "YWJjZGU=" YES

GitHub Source Image

Run the GitHub-source image in a container

Mount your local config file and secret file to specific positions with -v flags.

docker run -v $(pwd)/secret.json:/vance/secret/secret.json -v $(pwd)/config.json:/vance/config/config.json -p 8081:8081 source-github

source-github's People

Contributors

slyyq10 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.