Skip to main content

6 posts tagged with "GitHub"

View All Tags

· 5 min read

Using the events in GitHub for analysis can help you better understand the behavior of developer on GitHub. By analyzing data, you can draw various useful conclusions to support your business needs.

Concept

About events in GitHub

GitHub is a web-based hosting service that provides version control and collaboration features for software development projects. It allows users to create and store repositories for their projects, track changes to code, collaborate with others on coding projects, and contribute to open source software projects.

GitHub provides a number of features for tracking events related to your projects. These events include:

  1. Push events - occur when a user pushes code changes to a repository.
  2. Pull request events - occur when a user creates, updates, or closes a pull request.
  3. Issue events - occur when a user creates, updates, or closes an issue.
  4. Release events - occur when a user creates a new release of a project.
  5. Fork events - occur when a user forks a repository.
  6. Watch events - occur when a user starts or stops watching a repository.

GitHub also allows you to configure webhooks, which can be used to send notifications to external services when certain events occur in your repository. For example, you can configure a webhook to send a notification to a chat service when a pull request is created or updated.

Overall, GitHub provides a comprehensive set of features for tracking events related to your projects and collaborating with others on coding projects.

About Snowflake

Snowflake is a cloud-based data warehousing and analytics platform that allows organizations to store, manage, and analyze large amounts of data in a scalable and cost-effective way.

One of the key features of Snowflake is its architecture, which separates compute and storage. This allows organizations to scale compute and storage resources independently, and pay only for the resources they use. Snowflake also supports both structured and semi-structured data, including JSON, Avro, Parquet, and ORC.

Snowflake also provides a number of built-in features and services for data warehousing and analytics.

Overall, Snowflake provides a modern and flexible solution for data warehousing and analytics in the cloud, with a focus on scalability, performance, and security.

Easy GitHub to Snowflake integration with Vanus

Vanus’s open source connection allows you to integrate Vanus with your GitHub events to track event data and automatically send it to Snowflake.

Prerequisites

  • GitHub: your open-source repository.
  • Snowflake: a working Snowflake account.
  • Go to Vanus Playground :an online K8s environment where Vanus can be deployed.

Step 1: Deploying Vanus

  1. Login Vanus Playground.

  2. Refer to the Quick Start document to complete the Install Vanus & Install vsctl.

  3. Create an eventbus

    ~ # vsctl eventbus create --name github-snowflake
    +----------------+------------------+
    | RESULT | EVENTBUS |
    +----------------+------------------+
    | Create Success | github-snowflake |
    +----------------+------------------+

Step 2: Deploy the GitHub Source

  1. Set config file. Create config.yml in any directory, the content is as follows:

    target: http://192.168.49.2:30002/gateway/github-snowflake
    port: 8082
  2. Run the GitHub Source

    docker run -it --rm --network=host \
    -v ${PWD}:/vanus-connect/config \
    --name source-github public.ecr.aws/vanus/connector/source-github > a.log &
  3. Create a webhook under the Settings tab in your GitHub repository.

    setting-github

    Payload URL*

    Go to GitHub-Twitter Scenario under Payload URL.

    http://ip10-1-53-4-cfie9skink*******0-8082.direct.play.linkall.com

    Content type

    application/json

    Which events would you like to trigger this webhook?

    Send me everything.

Step 3: Deploy the Snowflake Sink

  1. Create a yml file named sink-snowflake.yml in the playground with the following command:

    cat << EOF > sink-snowflake.yml
    apiVersion: v1
    kind: Service
    metadata:
    name: sink-snowflake
    namespace: vanus
    spec:
    selector:
    app: sink-snowflake
    type: ClusterIP
    ports:
    - port: 8080
    name: sink-snowflake
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: sink-snowflake
    namespace: vanus
    data:
    config.yml: |-
    port: 8080
    snowflake:
    host: "myaccount.ap-northeast-1.aws.snowflakecomputing.com"
    username: "vanus_user"
    password: "snowflake"
    role: "ACCOUNTADMIN"
    warehouse: "xxxxxx"
    database: "VANUS_DB"
    schema: "public"
    table: "vanus_test"
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: sink-snowflake
    namespace: vanus
    labels:
    app: sink-snowflake
    spec:
    selector:
    matchLabels:
    app: sink-snowflake
    replicas: 1
    template:
    metadata:
    labels:
    app: sink-snowflake
    spec:
    containers:
    - name: sink-snowflake
    image: public.ecr.aws/vanus/connector/sink-snowflake
    imagePullPolicy: Always
    resources:
    requests:
    memory: "128Mi"
    cpu: "100m"
    limits:
    memory: "128Mi"
    cpu: "100m"
    ports:
    - name: http
    containerPort: 8080
    volumeMounts:
    - name: config
    mountPath: /vanus-connect/config
    volumes:
    - name: config
    configMap:
    name: sink-snowflake
    EOF
  2. Replace the config value with yours.

    host: "myaccount.ap-northeast-1.aws.snowflakecomputing.com"
    username: "vanus_user"
    password: "snowflake"
    role: "ACCOUNTADMIN"
    warehouse: "xxxxxx"
    database: "VANUS_DB"
    schema: "public"
    table: "vanus_test"
  3. Run snowflake sink in kubernetes.

    kubectl apply -f sink-snowflake.yaml

Step 4: Create subscription

Through the deployment of the above parts, the components required to push GitHub events to Snowflake have been deployed. And GitHub events can be filtered and processed through the filter and transformer capabilities of Vanus.

  1. Through a filter, you can filter out other events and only post the GitHub events they are interested in. For example:StarEvent(CloudEvents Adapter specification).
  2. Create a subscription in Vanus, and set up a transformer to extract and edit key information.
vsctl subscription create  \
--eventbus github-snowflake \
--sink 'http://sink-snowflake:8080' \
--filters '[
{ "exact": { "type": "com.github.star.created" } }
]'
--transformer '{
"define": {
"login": "$.data.repository.owner.login",
"star": "$.data.repository.stargazers_count",
"repo": "$.data.repository.html_url"
"sender":"$.data.sender.login",
"time":"$.data.repository.updated_at"
},
"template": "{\"owner\": \"<login>\",\"star\":\"<star>\",\"repo\":\"<repo>\",\"sender\":\"<sender>\",\"time\":\"<time>\"}"
}'

Step 5: Test

Open the Snowflake console and use the following command to make sure Snowflake has the data.

select * from public.vanus_test;

Summary

Snowflake provide a powerful platform for analyzing GitHub event data. By loading the data into Snowflake, creating tables, cleaning data, analyzing data, visualizing data, and drawing conclusions, you can get deep insights about the value of GitHub events and use those insights to optimize your business decisions.

· 6 min read

what-is-gihub

GitHub is a robust platform that enables developers to manage their software development projects efficiently, collaborate with others, and maintain a complete history of changes and versions.

This blog guides you through commands to make a pull request to a GitHub repository to learn how to contribute to open-source projects.

· 10 min read

How to store and analyze GitHub data in MySQL

If you are running an open-source project, I believe you must be interested in the following questions:

  • Has your project received more and more attention recently?

  • What organizations are having developers leaving your project at an accelerated rate?

  • Which organizations of developers are being attracted to your project?

  • What strategy should be adopted to attract more contributors?

Analyzing GitHub data can not only answer the above questions. And it can help you gain insight into important trends in more open-source projects. For example, it can help open source operators gain real-time insight into the trends of project developers, the latest trends of contributors, which organizations pay attention to your project, and so on.

This blog will use Vanus to build a data pipeline from GitHub to MySQL to help developers store GitHub data in MySQL in real-time. At the same time, some examples are given to help developers analyze GitHub data to gain insight into trends. The results are shown below:

githubdata-mysql

Table of Contents

What is GitHub

About GitHub

GitHub is an online software development platform. It's used for storing, tracking, and collaborating on software projects. It makes it easy for developers to share code files and collaborate with fellow developers on open-source projects. GitHub also serves as a social networking site where developers can openly network, collaborate, and pitch their work.

Since its founding in 2008, GitHub has acquired millions of users and established itself as a go-to platform for collaborative software projects. This free service comes with several helpful features for sharing code and working with others in real-time

What are GitHub events

When developers operate on GitHub, events will be generated, such as submitting Issue, submitting and PR, Commit code, etc. Common GitHub event types are as follows:

  • Issue event: Create, delete, closed, as signed, unsigned, labeled, unlabeled, etc.
  • PR event, Create, delete, closed, merged, edited, review requested, commit, etc.
  • Comments event, PR comments, issue comments, commit comments.
  • Stars event: A star is created or deleted from the repository.
  • Version releases event: Release created, edited, published, unpublished, or deleted.
  • Wiki events: Wiki page updated.
  • The team adds: Team added or modified on a repository.
  • Discussions event: created, edited, pinned, unpinned, locked, unlocked, transferred, answered, etc.
  • Labels event: Label created, edited, or deleted.
  • Milestone event: Milestone created, closed, opened, edited, or deleted.
  • Code scanning alerts: Code Scanning alerts are created, fixed in a branch, or closed.

What is MySQL

MySQL is a popular open-source relational database management system (RDBMS) used for storing and retrieving data in a structured manner. It was developed and is maintained by the Swedish company MySQL AB. MySQL is used by many websites and applications to store their data and is a popular choice due to its ease of use, fast performance, and reliability. It is based on the Structured Query Language (SQL), which is the standard language for managing relational databases. MySQL is compatible with various operating systems, including Windows, Linux, and macOS, and is often used in combination with other technologies such as PHP, Python, and Java to build dynamic, data-driven web applications.

How to Connect GitHub to MySQL

The schematic diagram of system deployment is as follows:

deploy-pipeline

Prerequisites

  • Playground: An online k8s environment where Vanus can be deployed.

  • GitHub: Your open-source repository

Step 1: Deploying Vanus in the playground

1 Enter the login page and click the Continue with Github button to log in with the GitHub account

playground-login

2 Wait for the automatic deployment of Kubernetes to complete, about the 30s.

playground

3 Deploy Vanus to the terminal on the right side of the web page

kubectl apply -f https://vanus.s3.us-west-2.amazonaws.com/releases/v0.4.0/vanus.yaml

Verify: watch -n2 kubectl get po -n Vanus,

 $ kubectl get po -n vanus
vanus-controller-0 1/1 Running 0 96s
vanus-controller-1 1/1 Running 0 72s
vanus-controller-2 1/1 Running 0 69s
vanus-gateway-8677fc868f-rmjt9 1/1 Running 0 97s
vanus-store-0 1/1 Running 0 96s
vanus-store-1 1/1 Running 0 68s
vanus-store-2 1/1 Running 0 68s
vanus-timer-5cd59c5bf-hmprp 1/1 Running 0 97s
vanus-timer-5cd59c5bf-pqkd5 1/1 Running 0 97s
vanus-trigger-7685d6cc69-8jgsl 1/1 Running 0 97s

4 Install vsctl (the command line tool)

curl -O https://vsctl.s3.us-west-2.amazonaws.com/releases/v0.4.0/linux-amd64/vsctl
chmod ug+x vsctl
mv vsctl /usr/local/bin

5 Set the endpoint for vsctl to access Vanus

export VANUS_GATEWAY=192.168.49.2:30001

6 Create eventbus

$ vsctl eventbus create  GitHub-MySQL
+----------------+-------------+
| RESULT | EVENTBUS |
+----------------+-------------+
| Create Success | github-slack|
+----------------+-------------+

Step 2: Deploy the GitHub source connector

1 Create webhook in GitHub repo

create-webhook

Payload URL *

http://ip10-1-53-4-cfie9skinko0oisrvrq0-8082.direct.play.linkall.com

This is the address of the GitHub source connector that can be accessed by the public network provided by playground. GitHub can directly push events to the GitHub source connetor provided by Vanus through this address. If developers need to deploy in their own environment, they need to provide an address that can be accessed by the public network.

Content type

application/json

Which events would you like to trigger this webhook?

Send me everything.

2 Set config file

Create config.yml in any directory, the content is as follows

{
"v_target": "http://192.168.49.2:30001/gateway/GitHub-MySQL",
"v_port": "8082"
}

3 Deploy the GitHub source connector and run the following command in the same directory:

docker run --network=host -v $(pwd)/config.json:/vance/config/config.json  --rm vancehub/source-github > a.log &

Step 3: Deploy MySQL on Docker

1 Pull MySQL image

$ docker pull mysql:latest

2 Deploy MySQL on Docker

$ docker run --network=host -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql

3 Login MySQL

$ docker exec -it mysql mysql -uroot -p 

4 Create a database and table

Create a database named github and create a table named stargazers_info in it to store github star events

create database github;
CREATE TABLE IF NOT EXISTS github.stargazers_info
(
`user` varchar(100) NOT NULL,
`stargazers_count` int NOT NULL,
`action` varchar(100) NOT NULL,
`startime` date NOT NULL,
`organizations` varchar(100) NOT NULL,
`homepage` varchar(100) NOT NULL,
PRIMARY KEY (`user`)
);

Step 4: Deploy the MySQL sink connector

1 Create config.yml in any directory, the content is as follows

db:
host: "localhost"
port: 3306
username: "vanus_test"
password: "123456"
database: "vanus_test"
table_name: "user"

insert_mode: UPSERT

2 Deploy the slack sink connector

docker run -it --rm --network=host\
-v ${PWD}:/vanus-connect/config \
--name sink-mysql public.ecr.aws/vanus/connector/sink-mysql > a.log &

Store Github star events to MySQL

1 Create a subscription in Vanus

Subscription is an event routing mechanism provided by Vanus, through which events in the Vanus event bus can be routed to any accessible endpoint. At the same time, the rules for transforming events can be specified through the --transformer option in ss, and the filtering rules can be specified through the --filter option.

Now we will create a subscription to read events from the previously created github-twitter-scenario and define conversion rules to convert them. Then, the converted events are stored in MySQL through Vanus's MySQL sink connector.

The command to create ss is as follows:

vsctl subscription create  \
--eventbus github-twitter-scenario \
--sink 'http://sink-mysql:8080' \
--transformer '{
"define": {
"user":"$.data.sender.login",
"stargazers_count":"$.data.stargazers_count",
"action":$.data.action,
"startime":"$.data.repository.updated_at",
"organizations":$.data.sender.organizations_url",
"homepage":"$.data.sender.html_url"
},
"template": "{\"user\": \"${user}\",\"action\":\"${action}",\"startime\": \"${startime}\",\"organizations\": \"${organizations}\",\"homepage\": \"${homepage}\"}"
}'

Explain:

• Line 1: Create a subscription via vsctl.

• Line 2: Set which eventbus event the subscription handles.

• Line 3: The sink parameter is the destination address to deliver the GitHub event processed by Vanus.

• Line 4: Declare to create a transformer, which extract user, action,startime,organizationsand and homepage from github's event

column nameDescription
userWho starred the project
stargazers_countHow many stars does the project have now
actionOperation type, click star or delete star
startimeTime of occurrence
organizationsDeveloper's Organization Link
homepageDeveloper's github homepage lin

• Line 11: Edit converted GitHub data to send to MySQL

2 Waiting for developer star project

3 Query data in MySQL

select * from github.stargazers_info;

githubdata-mysql

Analyze GitHub data

Since an event pipeline has been established between GitHub and MySQL. Over time, event data from GitHub will be continuously stored in MySQL. We can analyze based on the GitHub data in MySQL at any time to grasp the situation of open-source projects in real time. The following are some examples of our commonly used analysis of GitHub data

1 Which organizations have developers most interested in our open source projects ?

Analysis method: Group statistics of how many developers in each organization have clicked on the star for the project, and sort them. The SQL command is as follows:

select organizations,count(organizations) as num from github.stargazers_info where action='created' group by organizations order by num desc;

analyze1

From the analysis results, it can be seen that JUCE paid the most attention to the project.

2 What is the trend of recent project attention ?

Analysis method: Count the number of people who have clicked on the star every day in recent days, and sort them by time. The SQL command is as follows:

select startime,count(*) as starnumber from github.stargazers_info  where action='created'  group by startime order by startime;

analyze2

From the analysis results, from July 1st to July 5th, the number of people who click on the star basically increases every day. Therefore, our open-source projects have recently attracted more and more attention from developers.

3 Which organizations have developers unfollowed projects recently?

Analysis method: Find out which organizations have developers who recently unfollowed projects. The SQL command is as follows:

select organizations,count(organizations) as num from github.stargazers_info where action='deleted' group by organizations order by num desc;

analyze3

From the analysis results, it can be seen that the developers of SPEX and LaM are losing interest in the project

Conclusion:

This blog shows how to help developers build an event pipeline from GitHub to MySQL through Vanus. Developers can follow the steps given in the article to build an event pipeline in the Vanus playground within 5 minutes. Of course, according to the steps in the article, developers also open source and quickly build their own event pipelines in their own k8s environment. This article not only gives detailed steps to build an event pipeline but also gives an example of how to analyze GitHub events in MySQL. Developers can refer to examples to explore more analysis methods by themselves.

· 4 min read

github

GitHub is a robust platform that enables developers to manage their software development projects efficiently, collaborates with others, and maintain a complete history of changes and versions.

If you are new to using GitHub and Git, learning how to download open-source code from GitHub is an excellent place to start. This blog will talk about how to download files from GitHub.

· 8 min read

Build a notification system that pushes any GitHub event to Slack in 5 minutes

If you have an open-source project on GitHub, you definitely need to know who is attracted to your project in real-time. For example, whether someone has starred the project or submitted an Issue or a PR. How can we get the status of open-source projects in real-time? It is obviously not a good way to keep checking the GitHub page.

This article will help open-source enthusiasts to deliver any Github events to Slack through Vanus in real-time. In this way, developers can know the status of open source projects in real-time without logging in to GitHub, so that developers can quickly respond to the following GitHub events.

This article will show how to do this in 5 minutes on playground with Vanus and Vanus Connect. The results are shown below:

GitHub-to-Slack-Result

Table of Contents

What is GitHub

About GitHub

GitHub is an online software development platform. It's used for storing, tracking, and collaborating on software projects. It makes it easy for developers to share code files and collaborate with fellow developers on open-source projects. GitHub also serves as a social networking site where developers can openly network, collaborate, and pitch their work.

Since its founding in 2008, GitHub has acquired millions of users and established itself as a go-to platform for collaborative software projects. This free service comes with several helpful features for sharing code and working with others in real-time.

What are GitHub events

When developers operate on GitHub, events will be generated, such as submitting Issues, submitting PR, committing code, etc. Common GitHub event types are as follows:

  • Issue event: create, delete, closed, as signed, unsigned, labeled, unlabeled, etc.
  • PR event: create, delete, closed, merged, edited, review requested, commit, etc.
  • Comments event: PR comments, Issue comments, commit comments.
  • Stars event: a star is created or deleted from the repository.
  • Version releases event: release created, edited, published, unpublished, or deleted.
  • Wiki events: Wiki page updated.
  • The team adds: team added or modified on a repository.
  • Discussions event: created, edited, pinned, unpinned, locked, unlocked, transferred, answered, etc.
  • Labels event: label created, edited, or deleted.
  • Milestone event: milestone created, closed, opened, edited, or deleted.
  • Code scanning alerts: code scanning alerts are created, fixed in a branch, or closed.

Why need GitHub events

GitHub events provide an easy way to keep track of your GitHub repository without monitoring its status manually. They’re basically a notification system that offers a high level of customizability.

Through GitHub events, you can learn a lot in real time, such as who starred the project, who submitted the PR, and whether a new version was released. At the same time, GitHub events can also trigger some operations, such as compiling code, automatic deployment, security checks, and so on.

What is Slack

Slack is an all-purpose communication platform and collaboration hub. It includes instant messaging, voice and video calls, and a suite of tools to help groups share information and work together. A Slack workspace is your team's home, similar to a dashboard .Slack Channels are shared group chat rooms for members of a workspace. Users can communicate with the entire team or certain team members in various channels.

How to Connect GitHub to Slack

Prerequisites

  • Playground: an online k8s environment where Vanus can be deployed.
  • GitHub: your open-source repository.
  • Slack: a working Slack account.

Step 1: Deploying Vanus in the playground

1 Enter the login page and click the continue with Github button to log in with the GitHub account.

playground-login

2 Wait for the automatic deployment of Kubernetes to complete, about 30 sec.

playground

3 Deploy Vanus to the terminal on the right side of the web page.

kubectl apply -f https://dl.vanus.ai/all-in-one/v0.6.0.yml

Verify:

 $ watch -n2 kubectl get po -n vanus
vanus-controller-0 1/1 Running 0 96s
vanus-controller-1 1/1 Running 0 72s
vanus-controller-2 1/1 Running 0 69s
vanus-gateway-8677fc868f-rmjt9 1/1 Running 0 97s
vanus-store-0 1/1 Running 0 96s
vanus-store-1 1/1 Running 0 68s
vanus-store-2 1/1 Running 0 68s
vanus-timer-5cd59c5bf-hmprp 1/1 Running 0 97s
vanus-timer-5cd59c5bf-pqkd5 1/1 Running 0 97s
vanus-trigger-7685d6cc69-8jgsl 1/1 Running 0 97s

4 Install vsctl (the command line tool).

curl -O https://dl.vanus.ai/vsctl/latest/linux-amd64/vsctl
chmod ug+x vsctl
mv vsctl /usr/local/bin

5 Set the endpoint for vsctl to access Vanus.

export VANUS_GATEWAY=192.168.49.2:30001

6 Create eventbus.

$ vsctl eventbus create  github-slack
+----------------+-------------+
| RESULT | EVENTBUS |
+----------------+-------------+
| Create Success | github-slack|
+----------------+-------------+

Step 2: Deploy the GitHub source connector

1 Create webhook in GitHub repo.

create-webhook

Payload URL *

Get your payload URL in the GitHub to Twitter scenario under Payload URL.
Example: http://ip10-1-53-4-cfie9skinko0oisrvrq0-8082.direct.play.linkall.com

This is the address of the GitHub source connector that can be accessed by the public network provided by playground. GitHub can directly push events to the GitHub source connetor provided by Vanus through this address. If developers need to deploy in their own environment, they need to provide an address that can be accessed by the public network.

Content type

application/json

Which events would you like to trigger this webhook?

Send me everything.

2 Set config file

Create config.yml in any directory, the content is as follows:

"target": "http://192.168.49.2:30002/gateway/github-slack"
"port": 8082

3 Deploy the GitHub source connector and run the following command in the same directory.

docker run -it --rm --network=host \
-v ${PWD}:/vanus-connect/config \
--name source-github public.ecr.aws/vanus/connector/source-github > a.log &

Step 3: Creating a Slack app

1 Create a Slack app.

First, log in to Slack and click Create New APP, then select From Scrath, and fill in the App Name, select the corresponding Workspace.

create-slack-app

2 Setting permissions.

Select OAuth & Permissions , click add an OAuth Scope in the Bot Token Scopes section of the Scope tab, and add chat:write and chat:write.public two types of permissions.

setting-permissions

Reinstall to Workspace.

reinstall

The Slack app is created.

Step 4: Deploy the Slack sink connector on kubernetes

1 Create config.yml in any directory, the content is as follows:

curl -O https://scenario-utils.s3.us-west-2.amazonaws.com/sink-slack.yaml 

2 Open sink-slack.yml, replace values of default , app_name, token, default_channel with yours.

slink-slack

3 Deploy the Slack sink connector.

 kubectl apply -f sink-slack.yaml

Test Result

Through the deployment of the above four parts, the components required to push GitHub events to the notification system of Slack have been deployed. The system can push arbitrary GitHub events to Slack. And GitHub events can be filtered and processed through the filter and transformer capabilities of Vanus.

  • Through a filter, developers can filter out other events and only post the GitHub events they are interested in.
  • Developers can process GitHub events through a transformer, extract key information from GitHub events, and arrange them according to their own needs.

Create a Vanus subscription and set a filter or transformer in the subscription to achieve the above requirements. This article provides an example of event delivery for readers' reference: Get the event of Github star and post it to Slack.

Create a subscription in Vanus, and set up a transformer to extract and edit key information.

vsctl subscription create  \
--eventbus github-slack \
--sink 'http://sink-slack:8080' \
--transformer '{
"define": {
"user":"$.data.sender.login",
"time":"$.data.repository.updated_at",
"homepage":"$.data.sender.html_url",
"stargazers_count": "$.data.repository.stargazers_count",
"repo": "$.data.repository.html_url"
},
"template": "{\"subject\": \"<repo>\",\"message\":\"Hi Team, GitHub user < <user> > just stared Vanus repository at <time> . Check out his GitHub home page here: <homepage>. We have <stargazers_count> stars now !\"}"
}'

Explain:

• Line 1: Create a subscription via vsctl.

• Line 2: Set which eventbus event the subscription handles.

• Line 3: The sink parameter is the destination address to deliver the GitHub event processed by Vanus.

• Line 4: Declare to create a transformer, which extracts the user name from the GitHub event, clicks on the star time, the current number of stars, the operation type, and other variables, edits it into a sentence, and delivers it to Slack.

• Line 6: Declare user, and get the username of the dot star from the GitHub event.

• Line 7: Declare time, and get the time of clicking star from the GitHub event.

• Line 8: Declare the homepage, and get the GitHub home page address of the developer who clicked star from the GitHub event.

• Line 12: Edit the specific content of the delivery: Hi Team, GitHub user < xxx > just stared the Vanus repository at 2023-0x-xxTxx:18:03Z . Check out his GitHub home page here: https://github.com/xxxx . We have xxx stars now!

Result:

result

Conclusion

This article describes how to build a notification system that pushes any GitHub event to Slack through Vanus. And an example is given: get the event of Github star, extract the key information of the event through Vanus, and re-edit the information and post it to Slack. Developers can also refer to examples to obtain and process any GitHub events, such as Issue events, comments events, WIKI update events, and so on. Through the construction of this system, developers can perceive real-time status changes in GitHub repo in real time.

· 3 min read

As a GitHub and OSS enthusiast, have you ever experienced missing some of your important GitHub emails because tons of unread emails waiting in your mailbox . Or you wanna receive a custom notification when someone stars your repo but GitHub can never send such notifications to you.

Now, problem solved! You can receive custom event notifications directly in your Twitter account without checking your email by using a Serverless Message Queue — Vanus.

github.png